@vitest/expect
5.0.5 · 15 Oct 2026MIT151.9M / weekRepositoryHomepagenpmAtom feed
0.34.7 is the newest release of 0.32.x.
In short
4 breaking4 new6 fixed
- breaking
Throw an error, if the module cannot be resolved
- breaking
Improve globs
- breaking
Add
@vitest/coverage-v8package - breaking
mocker: Don't restore mock to the original if the module is automocked
Release note
Breaking Changes
- breaking
Throw an error, if the module cannot be resolved
Vitest used to fall back to the original import when it could not resolve it to the file path or the virtual module. This leads to hard-to-find module graph mismatches if you had incorrect alias or relied on relative imports to be resolved to the project root (which is usual behavior in TypeScript) because the code accidentally "worked". With this release, Vitest will now throw an error if it cannot resolve the module - there are possible edge cases that are not covered yet, so if you have any problems with this, please open a separate issue with reproduction.
- breaking
Improve globs
Vitest now has glob patterns similar to Jest for better compatibility. It's possible that some files will be considered test files when previously they were not. For example, Vitest now considers
test.jsto be a test file. Also any file in__tests__is now considered to be a test, not just files withtestorspecsuffix.
- breaking
Add
@vitest/coverage-v8packageVitest now uses v8 code coverage directly for better performance.
@vitest/coverage-c8is deprecated as Vitest no longer uses c8 package for coverage output. It will not be updated anymore, and Vitest will fail in the next version if the user hasc8as their coverage provider. Please, install the new@vitest/coverage-v8package if you previously used@vitest/coverage-c8.
- breaking
mocker: Don't restore mock to the original if the module is automocked
spy.mockRestoreon auto-mocked named exports will no longer restore their implementation to the actual function. This behavior better matches what Jest does.
Features
Support ssr optimizer
Image type add apng
expect: Support
expect.softrunner: Support using function/class as
describe/testname
Bug Fixes
The cli option is passed to coverage.exclude
optimizer: Always respect optimizeDeps even if include/exclude is overridden
runner: Ensure Vitest is deduped
ui: Don't cache coverage assets
vite-node: Circular import stuck
watch: Junit reporter fails to re-generate report