fix(test): migrate fusion-plugin-reports vitest config from deprecated environmentMatchGlobs to test.projects
Resolves CI failures where Node.js 24 caused ReferenceError: window is not defined in non-dashboard tests that shared setupFiles with dashboard tests. Follows the same pattern already used by fusion-plugin-roadmap: split into two vitest projects with proper environment isolation: - reports-dashboard: jsdom, includes src/dashboard/** tests + dashboard test-setup.ts - reports-node: node, includes all other tests, excludes dashboard tests No test changes — same 104 tests, same pass/fail state.
This commit is contained in:
@@ -13,15 +13,35 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
test: {
|
||||
include: ["src/**/__tests__/**/*.test.{ts,tsx}", "src/**/*.test.{ts,tsx}"],
|
||||
environmentMatchGlobs: [["src/dashboard/**", "jsdom"]],
|
||||
setupFiles: [
|
||||
fileURLToPath(new URL("../../packages/core/src/__test-utils__/vitest-setup.ts", import.meta.url)),
|
||||
fileURLToPath(new URL("./src/dashboard/test-setup.ts", import.meta.url)),
|
||||
],
|
||||
globalSetup: [fileURLToPath(new URL("../../packages/core/src/__test-utils__/vitest-teardown.ts", import.meta.url))],
|
||||
pool: "threads",
|
||||
maxWorkers,
|
||||
poolOptions: { threads: { minThreads: 1, maxThreads: maxWorkers }, forks: { minForks: 1, maxForks: maxWorkers } },
|
||||
projects: [
|
||||
{
|
||||
extends: true,
|
||||
test: {
|
||||
name: "reports-dashboard",
|
||||
environment: "jsdom",
|
||||
include: ["src/dashboard/**/__tests__/**/*.test.{ts,tsx}", "src/dashboard/**/*.test.{ts,tsx}"],
|
||||
setupFiles: [
|
||||
fileURLToPath(new URL("../../packages/core/src/__test-utils__/vitest-setup.ts", import.meta.url)),
|
||||
fileURLToPath(new URL("./src/dashboard/test-setup.ts", import.meta.url)),
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: true,
|
||||
test: {
|
||||
name: "reports-node",
|
||||
environment: "node",
|
||||
include: ["src/**/__tests__/**/*.test.{ts,tsx}", "src/**/*.test.{ts,tsx}"],
|
||||
exclude: ["src/dashboard/**/__tests__/**/*.test.{ts,tsx}", "src/dashboard/**/*.test.{ts,tsx}"],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user