Skip to content
Closed
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
37 changes: 33 additions & 4 deletions backend/vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,39 @@ import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "node",
// Run tests in a forked child process that uses Node's native CJS
// module resolution instead of Vite's ESM pipeline. This prevents
// Vite's vite:import-analysis plugin from trying to parse require()
// calls in CJS source files as ESM, which throws SyntaxErrors.

// Use forked processes for better Node.js compatibility.
// This supports CommonJS modules and avoids ESM import-analysis
// issues when testing backend files that use require().

pool: "forks",

// Run tests sequentially within each fork.
fileParallelism: false,

// Display clear test results.
reporters: ["default"],

// Restore mocks between tests.
restoreMocks: true,
clearMocks: true,

// Reset test state between test files.
isolate: true,

// Enable coverage configuration.
coverage: {
enabled: false,
reporter: ["text", "html"],
exclude: [
"node_modules/**",
"coverage/**",
"**/*.config.js",
"**/*.config.ts",
"**/test/**",
"**/*.test.js",
"**/*.spec.js",
],
},
},
});
Loading