From 8ffb8b646a89fc7fc930039597f329fcfe090152 Mon Sep 17 00:00:00 2001 From: Rudolf Kovalov Date: Sun, 1 Mar 2026 16:47:11 +0200 Subject: [PATCH 1/5] feat(test): add build export smoke tests --- .github/workflows/ci.yml | 5 +++- .github/workflows/publish.yml | 3 +++ package.json | 1 + rstest.build.config.ts | 9 ++++++++ test/build.test.ts | 43 +++++++++++++++++++++++++++++++++++ tsconfig.json | 2 +- 6 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 rstest.build.config.ts create mode 100644 test/build.test.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3ee9b5..0fde13d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,4 +46,7 @@ jobs: run: pnpm test:coverage - name: Build - run: pnpm build \ No newline at end of file + run: pnpm build + + - name: Test build exports + run: pnpm test:build \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 42f71fb..6dc1eb4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -65,6 +65,9 @@ jobs: - name: Build run: pnpm build + - name: Test build exports + run: pnpm test:build + - name: Apply changesets id: version run: | diff --git a/package.json b/package.json index e0363d6..acf1db5 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/rstest.build.config.ts b/rstest.build.config.ts new file mode 100644 index 0000000..8477a26 --- /dev/null +++ b/rstest.build.config.ts @@ -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'], +}); diff --git a/test/build.test.ts b/test/build.test.ts new file mode 100644 index 0000000..6925738 --- /dev/null +++ b/test/build.test.ts @@ -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:dist`. + */ + +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(); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 501af31..98f09a7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,5 @@ "useDefineForClassFields": true, "allowImportingTsExtensions": true }, - "include": ["src"] + "include": ["src", "test"] } From 76607ac9cf017a936b1ec4eeed8765e25d62babb Mon Sep 17 00:00:00 2001 From: Rudolf Kovalov Date: Sun, 1 Mar 2026 16:48:12 +0200 Subject: [PATCH 2/5] chore(changeset): add changeset for build test feature --- .changeset/good-paws-build.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changeset/good-paws-build.md diff --git a/.changeset/good-paws-build.md b/.changeset/good-paws-build.md new file mode 100644 index 0000000..a845151 --- /dev/null +++ b/.changeset/good-paws-build.md @@ -0,0 +1,2 @@ +--- +--- From d0c0e9d041a18656f13c15b01d0794ee101a7547 Mon Sep 17 00:00:00 2001 From: Rudolf Kovalov Date: Sun, 1 Mar 2026 16:55:51 +0200 Subject: [PATCH 3/5] chore(config): add tsconfig for test folder --- test/tsconfig.json | 4 ++++ tsconfig.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/tsconfig.json diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 0000000..379a994 --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../tsconfig.json", + "include": ["."] +} diff --git a/tsconfig.json b/tsconfig.json index 98f09a7..501af31 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,5 @@ "useDefineForClassFields": true, "allowImportingTsExtensions": true }, - "include": ["src", "test"] + "include": ["src"] } From fae1736f64270d6593d63b430b84d272793c62ae Mon Sep 17 00:00:00 2001 From: Rudolf Kovalov Date: Sun, 1 Mar 2026 16:57:46 +0200 Subject: [PATCH 4/5] docs(test): fix script name in build test comment --- test/build.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/build.test.ts b/test/build.test.ts index 6925738..5214670 100644 --- a/test/build.test.ts +++ b/test/build.test.ts @@ -1,7 +1,7 @@ /** * 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:dist`. + * Run after `pnpm build` via `pnpm test:build`. */ describe('@rstackio/services/safe', () => { From 4542d0c935060112440e3942752b973deeaada26 Mon Sep 17 00:00:00 2001 From: Rudolf Kovalov Date: Sun, 1 Mar 2026 17:00:45 +0200 Subject: [PATCH 5/5] chore(test): update source for test --- rstest.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/rstest.config.ts b/rstest.config.ts index a182e5f..ecfd367 100644 --- a/rstest.config.ts +++ b/rstest.config.ts @@ -5,6 +5,7 @@ export default defineConfig({ extends: withRslibConfig(), globals: true, testEnvironment: 'happy-dom', + include: ['src/**/*.test.ts'], coverage: { provider: 'istanbul', thresholds: {