Skip to content

Commit 0c1ff72

Browse files
taearlsclaude
andcommitted
fix: configure separate test script for Worker tests
- Exclude workers/** from main Vitest config to prevent module resolution errors - Add test:worker script to run Worker tests with their dedicated config - Update test:all to include Worker tests in the full test suite - Worker tests now run correctly with Cloudflare Workers pool Worker tests: ✅ 15 passed (15) Main app tests: ✅ 160 passed, 1 skipped (161) The Worker tests use @cloudflare/vitest-pool-workers which requires a separate Vitest config. This change keeps Worker tests isolated while still allowing them to run as part of the full test suite. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c979d00 commit 0c1ff72

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
"test:vitest:ui": "vitest --ui",
2020
"test": "vitest run",
2121
"test:watch": "vitest watch",
22+
"test:worker": "npm run test --prefix workers/feature-flags",
2223
"test:integration": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress run --e2e'",
23-
"test:all": "npm run test && npm run test:integration",
24+
"test:all": "npm run test && npm run test:worker && npm run test:integration",
2425
"preview": "vite preview --open",
2526
"ci": "npm run lint:check && npm run oxlint:check && npm run format:check && npm run test:all && npm run build",
2627
"dev:flags": "npm run dev -w @portfolio/feature-flags",

vitest.config.mts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ export default (args: ViteConfigInput) =>
1010
defineConfig({
1111
test: {
1212
environment: "jsdom",
13-
exclude: [...configDefaults.exclude, "tests/integration/**"],
13+
exclude: [
14+
...configDefaults.exclude,
15+
"tests/integration/**",
16+
"workers/**",
17+
],
1418
globals: true,
1519
// NOTE: this option could be useful for unit test performance tuning
1620
// logHeapUsage: true,

0 commit comments

Comments
 (0)