Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/good-paws-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ jobs:
run: pnpm test:coverage

- name: Build
run: pnpm build
run: pnpm build

- name: Test build exports
run: pnpm test:build
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
- name: Build
run: pnpm build

- name: Test build exports
run: pnpm test:build

- name: Apply changesets
id: version
run: |
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"prepare": "simple-git-hooks",
"release": "pnpm publish --access public --provenance --no-git-checks",
"test": "rstest run",
"test:build": "rstest run --config rstest.build.config.ts",
"test:coverage": "rstest run --coverage",
"test:related": "rstest run --passWithNoTests",
"test:watch": "rstest watch"
Expand Down
9 changes: 9 additions & 0 deletions rstest.build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { withRslibConfig } from '@rstest/adapter-rslib';
import { defineConfig } from '@rstest/core';

export default defineConfig({
extends: withRslibConfig(),
globals: true,
testEnvironment: 'node',
include: ['test/**/*.test.ts'],
});
1 change: 1 addition & 0 deletions rstest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineConfig({
extends: withRslibConfig(),
globals: true,
testEnvironment: 'happy-dom',
include: ['src/**/*.test.ts'],
coverage: {
provider: 'istanbul',
thresholds: {
Expand Down
43 changes: 43 additions & 0 deletions test/build.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Smoke tests that run against the compiled dist/ output.
* Verifies every public module is importable and all expected exports are present.
* Run after `pnpm build` via `pnpm test:build`.
*/
Comment thread
coderabbitai[bot] marked this conversation as resolved.

describe('@rstackio/services/safe', () => {
it('exports safe()', async () => {
const mod = await import('../dist/safe/index.js');
expect(mod.safe).toBeTypeOf('function');
});
});

describe('@rstackio/services/data-provider', () => {
it('exports createSafeProvider() and createProvider()', async () => {
const mod = await import('../dist/data-provider/index.js');
expect(mod.createSafeProvider).toBeTypeOf('function');
expect(mod.createProvider).toBeTypeOf('function');
});
});

describe('@rstackio/services/mock', () => {
it('exports mock utilities', async () => {
const mod = await import('../dist/mock/index.js');
expect(mod.isMockEnabled).toBeTypeOf('function');
expect(mod.enableMock).toBeTypeOf('function');
expect(mod.disableMock).toBeTypeOf('function');
expect(mod.delay).toBeTypeOf('function');
});
});

describe('@rstackio/services/logger', () => {
it('exports Logger class', async () => {
const mod = await import('../dist/logger/index.js');
expect(mod.Logger).toBeTypeOf('function');
});
});

describe('@rstackio/services/errors', () => {
it('is importable (type-only module)', async () => {
await expect(import('../dist/errors/index.js')).resolves.toBeDefined();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});
});
4 changes: 4 additions & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../tsconfig.json",
"include": ["."]
}