Releases: vitest-dev/vitest
Releases · vitest-dev/vitest
v0.32.2
🐞 Bug Fixes
- browser: Don't fail on importing diff-sequences - by @sheremet-va (00b0e)
View changes on GitHub
v0.32.1
🚀 Features
- Export
registerConsoleShortcuts
fromvitest/node
- by @deot in #3563 (bc49b) - expect: Support
expect.unreachable
- by @fenghan34 and @sheremet-va in #3556 (8e385) - runner:
describe
/test
name support anonymous function - by @btea in #3562 (3d436)
🐞 Bug Fixes
- Avoid call stack recursion with large error (fix: #3060) - by @nathanmmiller and @sheremet-va in #3078 and #3060 (02196)
- Automatically remove define related configuration - by @btea in #3552 (368b8)
- Import
performance
fromperf_hooks
- by @Max10240 and wangbaolong.wbl in #3578 and #3579 (24ec8) - Revert concordance diff, use jest's diff output - by @sheremet-va in #3582 (9c7ea)
- Typo in config suggestion - by @Krisell in #3583 (68985)
- browser:
- mocker:
- Respect namespace import when hoisting vi.mock - by @sheremet-va in #3547 (158c4)
- ui:
- vite-node:
View changes on GitHub
v0.32.0
🚨 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)
View changes on GitHub
v0.31.4
🚀 Features
- Enable experimentalOptimizer - by @sheremet-va in #3413 (5a894)
🐞 Bug Fixes
- vite-node: Deps.inline doesn't work - by @sheremet-va in #3485 (be930)
View changes on GitHub
v0.31.3
🚀 Features
- Support
VITE_NODE_DEPS_MODULE_DIRECTORIES
from .npmrc - by @AriPerkkio in #3471 (393bf)
🐞 Bug Fixes
- logger: Print unhandled errors before summary - by @sheremet-va in #3474 (4c9a7)
- runner: Suite options do not propagate to nested suites (fix: #3467) - by @xsjcTony in #3473 and #3467 (9fb9d)
- vite-node: Clear importers when invalidating module - by @sheremet-va in #3475 (add29)
View changes on GitHub
v0.31.2
🚀 Features
- Throw error if using inline snapshot inside of
test.each
ordescribe.each
- by @fenghan34 and @sheremet-va in #3360 (7c2f7) - Pass down meta information to Node.js process - by @sheremet-va and @dammy001 in #3449 (e39ad)
- coverage: Add
reportOnFailure
option - by @AriPerkkio and @sheremet-va in #3453 (1988f) - dev: Add moduleDirectories option to the vitest config - by @fooddilsn and @sheremet-va in #3337 (b3602)
🐞 Bug Fixes
- Don't print empty diff - by @sheremet-va in #3437 (32b53)
- Don't restore methods in automocked dependencies - by @sheremet-va in #3438 (d1afd)
- Dot reporter scrollback buffer spam - by @gtm-nayan in #3415 (e6792)
- Gracefully exit when first
SIGINT
is received - by @AriPerkkio in #3407 (a2cc2) rejects
&resolves
breaks with thenable objects - by @fenghan34 in #3456 (4e996)- Prevent
birpc
timeouts whenMath.random
mock is not restored - by @AriPerkkio in #3460 (cd5d5) - Assertion diff message now handle non writable property correctly - by @PCreations in #3422 (f75ab)
- Extend logging of process timeout errors - by @AriPerkkio in #3452 (42643)
- Support requiring files with
less
extension - by @rluvaton in #3465 (4d045) - cli:
- Improve colors used when erroring - by @ghiscoding and @sheremet-va in #3349 (16681)
- runner:
- spy:
- Don't print received calls if there are no calls - by @sheremet-va in #3405 (41e11)
- typecheck:
- Show tsc errors not related to test files - by @sheremet-va in #3441 (a1da5)
- types:
- vite-node:
- Circular import stuck - by @Dunqing in #3418 (632ee)
- Coerce to string in import(dep) - by @jcbhmr and @sheremet-va in #3430 (b72eb)
- Don't remove sourcemap string in source code - by @rxliuli and @sheremet-va in #2918 and #3379 (02dc9)
- Don't externalize "dist" by default - by @sheremet-va in #3446 (306b2)
View changes on GitHub
v0.31.1
🚀 Features
- watch: Press
r
should rerun current pattern tests - by @Dunqing and @AriPerkkio in #3305 (69d27)
🐞 Bug Fixes
- Make sure thrown error is an object - by @sheremet-va in #3298 (a93be)
- Remove duplicate type - by @sheremet-va in #3303 (5382e)
- Throw an error, if tests are collected with a different vitest version - by @sheremet-va in #3301 (708b1)
- Support application/x-gzip metadata in html report - by @mzanelee and Michael Lee in #3333 (5bf7e)
- Correctly restore vi.fn implementation - by @sheremet-va in #3341 (2aff8)
- Display error message correctly - by @btea in #3314 (a5b3d)
- Exclude
cwd
from test name filter - by @AriPerkkio in #3353 (324a9) - Check error type before modifying it - by @sheremet-va in #3385 (c44d9)
toMatchInlineSnapshot
fails when file path includes parentheses - by @pacexy in #3370 and #3371 (dcf13)- Stop spying on a method, when it's restored - by @sheremet-va in #3386 (2cb1a)
- Test repeats - by @fenghan34 in #3369 (fb8fc)
- browser:
- Throw an error if test failed to load - by @sheremet-va in #3390 (b354b)
- Keep default export when rewriting exports - by @sheremet-va in #3389 (6501d)
- cli:
- Improve cac errors when mixing boolean and dot notation - by @AriPerkkio in #3302 (93fbd)
- reporter:
- Prevent deleting test reports stored in coverage directory - by @AriPerkkio in #3331 (ddbba)
- typecheck:
- Correctly resolve custom tsconfig path - by @sheremet-va in #3342 (c53ae)
- vite-node:
- Allow returning id not wrapped in promise - by @danielroe in #3312 (9836c)
View changes on GitHub
v0.31.0
🚨 Breaking Changes
-
Remove
browser
from allowed pools insidepoolMatchGlob
config option. Please, use Vitest workspaces for running tests in the browser. -
Move assertion declarations to expect package - by @sheremet-va in #3294 (cf3af)
- The change should be minor:
- declare namespace Vi { + declare module 'vitest' { interface Assertion<T = any> extends CustomMatchers<T> {} interface AsymmetricMatchersContaining extends CustomMatchers {} }
🚀 Features
- Update mock implementation to support ESM runtime, introduce "vi.hoisted" - by @sheremet-va in #3258 (0c09a)
- Bypass ESM import order restriction with
vi.hoisted
to run code before imports are executed:
You can also use it to pass variables tovi.hoisted(() => vi.setSystemTime(new Date(2022, 1, 1)))
vi.mock
:const { mockedMethod } = vi.hoisted(() => { return { mockedMethod: vi.fn() } }) vi.mock('./path/to/module.js', () => { return { originalMethod: mockedMethod } })
- Bypass ESM import order restriction with
- Add repeat method to tests - by @samkevin1 in #2652 (7c8f0)
- Add an option to hide skipped test lines - by @g4rry420 and @sheremet-va in #2745 (9bdb1)
- coverage: Watermarks for c8 - by @AriPerkkio in #3254 (730af)
- ui: Add html coverage - by @userquin and @sheremet-va in #3071 (e24cd)
- watch: Test run cancelling, feat:
--bail
option for cancelling test run - by @AriPerkkio in #3163 (8d460)
🐞 Bug Fixes
- Don't call global setup teardown twice - by @sheremet-va in #3188 (ba3d1)
- Reporter to log version before provider initalizations - by @AriPerkkio in #3131 (481b1)
- Throw an error if Vitest cannot access its internal state - by @sheremet-va in #3250 (fbb14)
- Warning suppression broken - by @IceQub3 in #3270 and #3271 (036de)
- Show correct diff in "toHaveBeenCalledWith" - by @sheremet-va in #3289 (19fcd)
- Don't print esm warning, if package name is not found - by @sheremet-va in #3292 (62c14)
- Support exactOptionalPropertyTypes - by @sheremet-va in #3293 (ba81d)
- Don't inline vite hmr and rollup types - by @sheremet-va in #3291 (1f118)
- browser:
- coverage:
thresholdAutoUpdate
to work withperFile
- by @AriPerkkio in #3182 (29eeb)- Throw error if fail to load built-in provider - by @AriPerkkio in #3217 (0a287)
- Stackblitz hangs with c8 - by @AriPerkkio in #3225 (d9fda)
- C8 to ignore vite's generated helpers - by @AriPerkkio in #3241 (21942)
- Workspaces c8 source maps - by @AriPerkkio in #3226 (efce3)
- docs:
- Correct typo and broken link to WebdriverIO - by @nathanbabcock in #3275 (c7da1)
- spy:
- vite-node:
- vitest:
- Also check for vite relative to vitest package - by @JoshuaKGoldberg and @sheremet-va in #3274 (a3393)
- watch:
- Run test files when added to filesystem - by @AriPerkkio in #3189 (7b2c8)
View changes on GitHub
v0.30.1
🐞 Bug Fixes
- Do not rely on global
performance
andAggregateError
- by @sheremet-va in #3171 (cce45) - Allow workspace without a config in the root - by @sheremet-va in #3173 (06852)
test.each
respectschaiConfig
- by @sheremet-va (4f6c1)- Use relative paths in source map's "sources" field - by @sheremet-va in #3177 (6b1b4)
- types:
- Allow augmenting jest namespace for custom assertions - by @sheremet-va in #3169 (905ec)
- Publish utils and snapshot .d.ts files for typescript - by @sheremet-va in #3172 (7af64)
- snapshot:
View changes on GitHub
v0.30.0
🚨 Breaking Changes
- Remove tinyspy internal properties on Vitest spies - by @sheremet-va in #3069 (2f1dc)
- Only support Node.js 14.18.0 or newer - by @danez in #2985 (287dc)
- Use "concordance" package to display diff instead of using custom diff - by @sheremet-va in #2828 (44630)
- Move snapshot implementation into @vitest/snapshot - by @sheremet-va in #3032 (6aff0)
- Bump coverage packages vitest peer dependency - by @AriPerkkio in #3126 (be1bf)
- Add workspace support - by @sheremet-va in #3103 (b9d1a)
- Experimental optimizer introduced in 0.29.0 is temporarily disabled.
🚀 Features
- Gzip html reporter's metadata - by @7rulnik in #3113 (7856e)
- Add chai config - by @btea in #3066 (6fcba)
- snapshot: Introduce
toMatchFileSnapshot
and auto queuing expect promise - by @antfu in #3116 (bdc06)
🐞 Bug Fixes
- Resolve reporters passed down to the CLI relative to the running directory - by @sheremet-va in #3097 (93c7e)
- Don't show "diff" in "serialized error" section - by @sheremet-va (326b2)
- Convert '--single-thread' and '--inspect' cli args to boolean - by @AriPerkkio in #3111 (83a9a)
- Stack trace point to incorrect file - by @ChenKS12138 and @sheremet-va in #3004 and #3115 (5cee4)
- Run benchmarks sequentially - by @thecodrr in #2004 and #3151 (430b4)