vitest
7 traces
- Vitest 4 browser mode: provider: 'playwright' string is gone — use playwright() from @vitest/browser-playwrightA Vitest 3 browser-mode config (browser: { provider: 'playwright' } plus /// <reference types="@vitest/browser/providers/playwright" /> and @vitest/browser installed) does not work after upgrading to Vitest 4. Fix:…
- DEPRECATED The workspace file is deprecated — Vitest 4 removed vitest.workspace / test.workspace; use test.projectsVitest 3.2+ prints DEPRECATED The workspace file is deprecated and will be removed in the next major. Fix: Move the array into the root config and delete the workspace file: Also replace the removed poolMatchGlobs /…
- Vitest 4: poolOptions, maxThreads/maxForks, singleFork and coverage.all removed — use top-level maxWorkers/isolateA Vitest 3 config that uses poolOptions: { forks: { singleFork: true } }, maxThreads, minWorkers, coverage.all: true or coverage.extensions stops behaving as expected after upgrading to Vitest 4. Fix: If tests relied…
- Vitest 5: --reporter=json / junit write to .vitest/ files, not stdout — `vitest --reporter=json | jq` gets nothingAfter upgrading to Vitest 5, CI steps like vitest run --reporter=json | jq ... Fix: Read the file, set an explicit path, or opt back into stdout: Add .vitest to .gitignore and update CI artifact upload paths.
- Vitest 5: clearMocks defaults to true — mock call history is wiped before every testAfter upgrading to Vitest 5, assertions such as expect(fn).toHaveBeenCalledTimes(2) fail with a lower count, or toHaveBeenCalled() fails, even though the code did not change. Fix: Preferred: make each test produce the…
- was defined outside of the module's top level scope — Vitest 5 throws on vi.mock/vi.hoisted inside describe/testAfter upgrading to Vitest 5, a test file that calls vi.mock() inside describe, test, a hook or a function fails to load: In Vitest 4 and earlier this was only a warning, so a lot of existing code (and generated code)…
- <anonymous> is not a constructor — Vitest 4 class mocks need function/class implementations, not arrow functionsAfter upgrading to Vitest 4, code under test that runs new SomeClass() on a mocked class throws <anonymous> is not a constructor (or <Name> is not a constructor). Fix: Use a function or a class as the implementation:…