Skip to content

Commit 6eff72a

Browse files
chore: replace deprecated poolMatchGlobs with test.projects (#78)
Fixes vitest 3.x deprecation warning by migrating from poolMatchGlobs to the projects API. Creates three test projects (unit, integration, concurrency) with appropriate pool isolation. Fixes #77
1 parent 5e3259d commit 6eff72a

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

packages/gateway/vitest.config.ts

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,45 @@ export default defineConfig({
66
environment: "node",
77
testTimeout: 10000,
88
setupFiles: ["./__tests__/setup.ts"],
9-
include: ["__tests__/**/*.test.ts"],
10-
exclude: ["__tests__/e2e/**/*.test.ts"],
11-
// Use forks pool for tests with shared state (concurrency module, server ports)
12-
// to isolate them from parallel execution. Other tests run in threads pool.
13-
// This fixes flaky tests from #70 and #72.
14-
pool: "threads",
15-
poolMatchGlobs: [
16-
// Integration tests start actual servers and need isolation
17-
["**/__tests__/integration/**", "forks"],
18-
// Concurrency tests modify shared module state
19-
["**/__tests__/concurrency.test.ts", "forks"],
20-
],
219
coverage: {
2210
provider: "v8",
2311
reporter: ["text", "lcov"],
2412
include: ["src/**/*.ts"],
2513
exclude: ["src/index.ts"], // Entry point tested via integration
2614
},
15+
// Use projects to run different test sets with different pools.
16+
// Integration and concurrency tests need isolation (forks pool)
17+
// to avoid flaky tests from shared state (#70, #72).
18+
projects: [
19+
{
20+
extends: true,
21+
test: {
22+
name: "unit",
23+
include: ["__tests__/**/*.test.ts"],
24+
exclude: [
25+
"__tests__/e2e/**/*.test.ts",
26+
"__tests__/integration/**/*.test.ts",
27+
"__tests__/concurrency.test.ts",
28+
],
29+
pool: "threads",
30+
},
31+
},
32+
{
33+
extends: true,
34+
test: {
35+
name: "integration",
36+
include: ["__tests__/integration/**/*.test.ts"],
37+
pool: "forks",
38+
},
39+
},
40+
{
41+
extends: true,
42+
test: {
43+
name: "concurrency",
44+
include: ["__tests__/concurrency.test.ts"],
45+
pool: "forks",
46+
},
47+
},
48+
],
2749
},
2850
});

0 commit comments

Comments
 (0)