🚨 Breaking Changes
- Throw an error, if the module cannot be resolved - by @sheremet-va in #3307 (1ad63)
- 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.
- Improve globs - by @nickmccurdy in #3392 (19ecc)
- 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.js
to be a test file. Also any file in__tests__
is now considered to be a test, not just files withtest
orspec
suffix.
- 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
- Add
@vitest/coverage-v8
package - by @AriPerkkio in #3339 (82112)- Vitest now uses v8 code coverage directly for better performance.
@vitest/coverage-c8
is 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 hasc8
as their coverage provider. Please, install the new@vitest/coverage-v8
package if you previously used@vitest/coverage-c8
.
- Vitest now uses v8 code coverage directly for better performance.
- mocker: Don't restore mock to the original if the module is automocked - by @sheremet-va in #3518 (c1004)
spy.mockRestore
on 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 - by @sheremet-va in #3490 (89842)
- Image type add apng - by @btea in #3498 (a53c2)
- expect: Support
expect.soft
- by @Dunqing in #3507 (7c687) - runner: Support using function/class as
describe
/test
name - by @fenghan34 in #3497 (15253)
🐞 Bug Fixes
- The cli option is passed to coverage.exclude - by @btea in #3506 (c37cd)
- optimizer: Always respect optimizeDeps even if include/exclude is overridden - by @sheremet-va in #3488 (eb285)
- runner: Ensure Vitest is deduped - by @sheremet-va in #3489 (2deb7)
- ui: Don't cache coverage assets - by @userquin in #3508 (952b5)
- vite-node: Circular import stuck - by @Dunqing in #3480 (50f07)
- watch: Junit reporter fails to re-generate report - by @AriPerkkio in #3496 (5b73c)