Problem
There are now two competing Vitest configurations and two setup files in the repository:
vite.config.ts declares test: { environment: "jsdom", globals: true, setupFiles: ["./test/setup.ts"] }
vitest.config.ts declares its own test block with setupFiles: './vitest.setup.ts', coverage settings, and an @ path alias
- Both
test/setup.ts and vitest.setup.ts exist
Vitest gives vitest.config.ts precedence over the test block in vite.config.ts, so the vite.config.ts test settings and test/setup.ts are silently ignored. Two sources of truth mean a contributor editing the wrong one sees no effect, and the @ alias and coverage settings only apply in one of them.
What needs to be done
- Choose one configuration file as authoritative (recommended:
vitest.config.ts, since it already has coverage and the alias).
- Remove the
test block from vite.config.ts, or delete vitest.config.ts and merge its settings into vite.config.ts.
- Delete the redundant setup file so only one remains, and ensure the surviving config points at it.
- Confirm the
@ alias resolves in tests and in the app build consistently (if the alias is kept, it must also exist in vite.config.ts and tsconfig.json).
Files
vite.config.ts
vitest.config.ts
test/setup.ts
vitest.setup.ts
Acceptance deliverables
- Exactly one Vitest config and one setup file remain.
- Editing the surviving setup file demonstrably affects test runs.
Tests to pass
npm test passes with the single configuration.
- A test asserting a jest-dom matcher passes, proving the setup file is loaded.
Problem
There are now two competing Vitest configurations and two setup files in the repository:
vite.config.tsdeclarestest: { environment: "jsdom", globals: true, setupFiles: ["./test/setup.ts"] }vitest.config.tsdeclares its owntestblock withsetupFiles: './vitest.setup.ts', coverage settings, and an@path aliastest/setup.tsandvitest.setup.tsexistVitest gives
vitest.config.tsprecedence over thetestblock invite.config.ts, so thevite.config.tstest settings andtest/setup.tsare silently ignored. Two sources of truth mean a contributor editing the wrong one sees no effect, and the@alias and coverage settings only apply in one of them.What needs to be done
vitest.config.ts, since it already has coverage and the alias).testblock fromvite.config.ts, or deletevitest.config.tsand merge its settings intovite.config.ts.@alias resolves in tests and in the app build consistently (if the alias is kept, it must also exist invite.config.tsandtsconfig.json).Files
vite.config.tsvitest.config.tstest/setup.tsvitest.setup.tsAcceptance deliverables
Tests to pass
npm testpasses with the single configuration.