Releases: vitest-dev/vitest
Releases · vitest-dev/vitest
v4.1.1
🚀 Features
- experimental:
- Expose
matchesTagsto test if the current filter matches tags - by @sheremet-va in #9913 (eec53) - Introduce
experimental.vcsProvider- by @sheremet-va in #9928 (56115)
- Expose
🐞 Bug Fixes
- Mark
TestProject.testFilesListinternal properly - by @sapphi-red in #9867 (54f26) - Detect fixture that returns without calling
use- by @oilater in #9831 and #9861 (633ae) - Drop vite 8.beta support - by @AriPerkkio in #9862 (b78f5)
- Type regression in vi.mocked() static class methods - by @purepear and @hi-ogawa in #9857 (90926)
- Properly re-evaluate actual modules of mocked external - by @hi-ogawa in #9898 (ae5ec)
- Preserve coverage report when html reporter overlaps - by @hi-ogawa in #9889 (2d81a)
- Provide
vi.advanceTimersto the preview provider - by @sheremet-va in #9891 (1bc3e) - Don't leak event listener in playwright provider - by @sheremet-va in #9910 (d9355)
- Open browser in
--standalonemode without running tests - by @sheremet-va in #9911 (e78ad) - Guard disposable and optional
body- by @sheremet-va in #9912 (6fdb2) - Resolve
retry.conditionRegExp serialization issue - by @nstepien and @hi-ogawa in #9942 (7b605) - collect:
- Don't treat extra props on
testreturn as tests - by @sheremet-va in #9871 (141e7)
- Don't treat extra props on
- coverage:
- Simplify provider types - by @AriPerkkio in #9931 (aaf9f)
- Load built-in provider without module runner - by @AriPerkkio in #9939 (bf892)
- expect:
- pretty-format:
View changes on GitHub
v4.1.0
Vitest 4.1 is out!
This release page lists all changes made to the project during the 4.1 beta. To get a review of all the new features, read our blog post.
🚀 Features
- Return a disposable from doMock() - by @kirkwaiblinger in #9332 (e3e65)
- Added chai style assertions - by @ronnakamoto and @sheremet-va in #8842 (841df)
- Update to sinon/fake-timers v15 and add
setTickModeto timer controls - by @atscott and @sheremet-va in #8726 (4b480) - Expose matcher types - by @sheremet-va in #9448 (3e4b9)
- Add
toTestSpecificationto reported tasks - by @sheremet-va in #9464 (1a470) - Show a warning if
vi.mockorvi.hoistedare declared outside of top level of the module - by @sheremet-va in #9387 (5db54) - Track and display expectedly failed tests (.fails) in UI and CLI - by @Copilot, sheremet-va and @sheremet-va in #9476 (77d75)
- Support tags - by @sheremet-va in #9478 (de7c8)
- Implement
aroundEachandaroundAllhooks - by @sheremet-va in #9450 (2a8cb) - Stabilize experimental features - by @sheremet-va in #9529 (b5fd2)
- Accept
neworallin--updateflag - by @sheremet-va in #9543 (a5acf) - Support
metain test options - by @sheremet-va in #9535 (7d622) - Support type inference with a new
test.extendsyntax - by @sheremet-va in #9550 (e5385) - Support vite 8 beta, fix type issues in the config with different vite versions - by @sheremet-va in #9587 (99028)
- Add assertion helper to hide internal stack traces - by @hi-ogawa and Claude Opus 4.6 in #9594 (eeb0a)
- Store failure screenshots using artifacts API - by @macarie in #9588 (24603)
- Allow
vitest listto statically collect tests instead of running files to collect them - by @sheremet-va in #9630 (7a8e7) - Add
--detect-async-leaks- by @AriPerkkio in #9528 (c594d) - Implement
mockThrowandmockThrowOnce- by @thor-juhasz and @sheremet-va in #9512 (61917) - Support
update: "none"and add docs about snapshots behavior on CI - by @hi-ogawa in #9700 (05f18) - Support playwright
launchOptionswithconnectOptions- by @hi-ogawa in #9702 (f0ff1) - Add
page/locator.markAPI to enhance playwright trace - by @hi-ogawa in #9652 (d0ee5) - api:
- Support tests starting or ending with
testinexperimental_parseSpecification- by @jgillick and Jeremy Gillick in #9235 (2f367) - Add filters to
createSpecification- by @sheremet-va in #9336 (c8e6c) - Expose
runTestFilesas alternative torunTestSpecifications- by @sheremet-va in #9443 (43d76) - Add
allowWriteandallowExecoptions toapi- by @sheremet-va in #9350 (20e00) - Allow passing down test cases to
toTestSpecification- by @sheremet-va in #9627 (6f17d)
- Support tests starting or ending with
- browser:
- Add
userEvent.wheelAPI - by @macarie in #9188 (66080) - Add
filterNodeoption to prettyDOM for filtering browser assertion error output - by @Copilot, sheremet-va and @sheremet-va in #9475 (d3220) - Support playwright persistent context - by @hi-ogawa, Claude Opus 4.6 and @sheremet-va in #9229 (f865d)
- Added
detailsPanelPositionoption and button - by @shairez in #9525 (c8a31) - Use BlazeDiff instead of pixelmatch - by @macarie in #9514 (30936)
- Add
findElementand enable strict mode in webdriverio and preview - by @sheremet-va in #9677 (c3f37)
- Add
- cli:
- Add @bomb.sh/tab completions - by @AmirSa12 and @sheremet-va in #8639 (200f3)
- coverage:
- Support
ignore start/stopignore hints - by @AriPerkkio in #9204 (e59c9) - Add
coverage.changedoption to report only changed files - by @kykim00 and @AriPerkkio in #9521 (1d939)
- Support
- experimental:
- Add
onModuleRunnerhook toworker.init- by @sheremet-va in #9286 (e977f) - Option to disable the module runner - by @sheremet-va and @AriPerkkio in #9210 (9be61)
- Add
importDurations: { limit, print }options - by @hi-ogawa, Claude Opus 4.6 and @sheremet-va in #9401 (7e10f) - Add print and fail thresholds for
importDurations- by @hi-ogawa and Claude Opus 4.6 in #9533 (3f7a5)
- Add
- fixtures:
- Pass down file context to
beforeAll/afterAll- by @sheremet-va in #9572 (c8339)
- Pass down file context to
- reporters:
- runner:
- Enhance
retryoptions - by @MazenSamehR, Matan Shavit, @AriPerkkio and @sheremet-va in #9370 (9e4cf)
- Enhance
- ui:
- Allow run individual test/suites - by @userquin in #9465 [(73b10)](https://github.com/vite...
v4.1.0-beta.6
🚀 Features
- Add
page/locator.markAPI to enhance playwright trace - by @hi-ogawa in #9652 (d0ee5) - vitest: Add run summary in GitHub Actions Reporter - by @macarie and jhnance in #9579 (96bfc)
🐞 Bug Fixes
- Fix
URL.nameon jsdom - by @hi-ogawa in #9767 (031f3) - Save and restore module graph in blob reporter - by @hi-ogawa in #9740 (84355)
- Don't silence reporter errors from test runtime events handler in normal run and --merge-reports - by @hi-ogawa in #9727 (4072d)
- Fix
vi.importActual()for virtual modules - by @hi-ogawa and Claude Opus 4.6 in #9772 (1e89e) - Throw
FixtureAccessErrorif suite hook accesses undefined fixture - by @sheremet-va in #9786 (fc2ce) - Allow hyphens in project config file name pattern - by @Koutaro-Hanabusa and @hi-ogawa in #9760 (33e96)
- Manual and redirect mock shouldn't
loadortransformoriginal module - by @hi-ogawa and Claude Opus 4.6 in #9774 (a8216) hideSkippedTestsshould not hidetest.todo- by @oilater in #9562 and #9781 (8181e)- browser: Types of
getCDPSessionandcdp()- by @AriPerkkio in #9716 (689a2)
View changes on GitHub
v4.1.0-beta.5
🚀 Features
- Implement
mockThrowandmockThrowOnce- by @thor-juhasz and @sheremet-va in #9512 (61917) - Support
update: "none"and add docs about snapshots behavior on CI - by @hi-ogawa in #9700 (05f18) - Support playwright
launchOptionswithconnectOptions- by @hi-ogawa in #9702 (f0ff1) - browser:
- coverage:
- Add
coverage.changedoption to report only changed files - by @kykim00 and @AriPerkkio in #9521 (1d939)
- Add
- ui:
🐞 Bug Fixes
- Don't propagate nested
aroundEach/Allerrors but aggregate them on runner - by @hi-ogawa in #9673 (b6365) - Show a better error if there is a pending dynamic import - by @sheremet-va in #9676 (7ef5c)
- Preserve stack trace of
resolves/rejectschained assertion error - by @hi-ogawa in #9679 (c6151) - Handle module-sync condition in vmThreads/vmForks require - by @lesleh in #9650 and #9651 (bb203)
- Hooks should respect
maxConcurrency- by @hi-ogawa in #9653 (16d13) - Recursively autospy module object - by @hi-ogawa in #9687 (695a8)
- Remove trailing spaces from diff error log - by @hi-ogawa and @sheremet-va in #9680 (395d1)
- Respect project
resolve.conditionsfor externals - by @hi-ogawa in #9717 (1d498) - Use object for WeakMap instead of a symbol to support webcontainers - by @sheremet-va in #9731 (c5225)
- Fix re-mocking virtual module - by @hi-ogawa in #9748 (3cbbb)
- Cancelling should stop current test immediately - by @AriPerkkio in #9729 (0cb2f)
- Make
mockObjectchange backwards compatible - by @sheremet-va in #9744 (84c69) - browser:
- Remove
--remote-debugging-addressfrom chrome args - by @hi-ogawa and @AriPerkkio in #9712 (f09bb) - Make sure userEvent actions support
ensureAwaited- by @sheremet-va in #9732 (97685)
- Remove
- reporter:
dotreporter leaves pending tests - by @AriPerkkio in #9684 (4d793)
- runner:
- Mark repeated tests as finished on last run - by @AriPerkkio in #9707 (cc735)
- types:
bench.reportersno longer gives type errors when passing file name string paths - by @Bertie690 in #9695 (093c8)
View changes on GitHub
v4.1.0-beta.4
🚀 Features
- Support type inference with a new
test.extendsyntax - by @sheremet-va in #9550 (e5385) - Support vite 8 beta, fix type issues in the config with different vite versions - by @sheremet-va in #9587 (99028)
- Add assertion helper to hide internal stack traces - by @hi-ogawa and Claude Sonnet 4.5 in #9594 (eeb0a)
- Store failure screenshots using artifacts API - by @macarie in #9588 (24603)
- Allow
vitest listto statically collect tests instead of running files to collect them - by @sheremet-va in #9630 (7a8e7) - Add
--detect-async-leaks- by @AriPerkkio in #9528 (c594d) - api: Allow passing down test cases to
toTestSpecification- by @sheremet-va in #9627 (6f17d) - fixtures: Pass down file context to
beforeAll/afterAll- by @sheremet-va in #9572 (c8339) - ui: Add duration sorting to explorer - by @julianhahn and @cursoragent in #9603 (209b1)
🐞 Bug Fixes
- Close vitest if it failed to start - by @sheremet-va in #9573 (728ba)
- Fix ssr environment runner in project - by @hi-ogawa in #9584 (09006)
- Trim trailing white spaces in code block - by @hi-ogawa in #9591 (f78be)
- Support inline snapshot inside test.for/each - by @hi-ogawa in #9590 (615fd)
- Apply source maps for external module stack trace - by @hi-ogawa in #9152 (79e20)
- Remove the
.namefrom statically collected test - by @sheremet-va in #9596 (b66ff) - Don't suppress warnings on pnp - by @sheremet-va in #9602 (89cbd)
- Support snapshot with
expect.soft- by @iumehara, @hi-ogawa and Claude Sonnet 4.5 in #9231 (3eb2c) - Log seed when only
sequence.shuffle.testsis enabled - by @kaigritun, Kai Gritun and @sheremet-va in #9576 (8182b) - Externalize
expect/src/utilsfromvitest- by @hi-ogawa in #9616 (48739) - Ignore test.override during static collection - by @sheremet-va in #9620 (09174)
- Increase stacktrace limit for
--detect-async-leaks- by @AriPerkkio in #9638 (9fd4c) - Hanging-reporter link in cli - by @flx-sta in #9649 (7c103)
- Fix teardown timeout of
aroundEach/Allwhen inneraroundEach/Allthrows - by @hi-ogawa in #9657 (4ec6c) - Fix ui mode / html reporter and coverage integration - by @hi-ogawa and Claude Sonnet 4.5 in #9626 (86fad)
- Don't continue when
aroundEach/Allsetup timed out - by @hi-ogawa in #9670 (bb013) - Align
VitestRunnerConfigoptional fields withSerializedConfig- by @hi-ogawa in #9661 (79520) - Handle Symbol values in format utility - by @nami8824 in #9658 (0583f)
- Deprecate
toBe*spy assertions in favor oftoHaveBeen*(andtoThrowError) - by @sheremet-va in #9665 (4d390) - chai: Don't allow
deepEqualin the config because it's not serializable - by @sheremet-va in #9666 (9ee99) - docs: Fix old
/config/#optionhash links causing hydration errors - by @hi-ogawa, Claude Sonnet 4.5 and @sheremet-va in #9610 (a603c) - expect: Support arbitrary value equality for
toThrowand make Error detection robust - by @hi-ogawa and Claude Sonnet 4.5 in #9570 (de215) - ui: Don't fail if --ui and --root are specified together - by @sheremet-va in #9536 (d9305)
🏎 Performance
- pretty-format: Combine DOMElement plugins - by @sheremet-va in #9581 (da85a)
View changes on GitHub
v4.1.0-beta.3
🚀 Features
- Implement
aroundEachandaroundAllhooks - by @sheremet-va in #9450 (2a8cb) - Stabilize experimental features - by @sheremet-va in #9529 (b5fd2)
- Accept
neworallin--updateflag - by @sheremet-va in #9543 (a5acf) - Support
metain test options - by @sheremet-va in #9535 (7d622) - api:
- Add
allowWriteandallowExecoptions toapi- by @sheremet-va in #9350 (20e00)
- Add
- browser:
- experimental:
🐞 Bug Fixes
- Handle
external/noExternalduringconfigEnvironmenthook - by @hi-ogawa and Claude Opus 4.5 in #9508 (59ea2) - Replace default ssr environment runner with Vitest server module runner - by @hi-ogawa and Claude Opus 4.5 in #9506 (cd5db)
- Propagate experimental CLI options to child projects - by @hi-ogawa and Claude Opus 4.5 in #9531 (b624f)
- Show a warning when
browser.isolateis used - by @sheremet-va in #9410 (3d48e) - Fix
vi.mock({ spy: true })node v8 coverage - by @hi-ogawa, hi-ogawa and Claude Opus 4.5 in #9541 (687b6) - Don't show internal ssr handler in errors - by @sheremet-va in #9547 (76c43)
- browser:
- Hide injected data-testid attributes - by @sheremet-va in #9503 (c8d2c)
- Throw an error if iframe was reloaded - by @sheremet-va in #9516 (73a81)
- Encode projectName in browser client URL - by @dkkim0122 in #9523 (5b164)
- Don't take failure screenshot if tests have artifacts created by
toMatchScreenshot- by @macarie in #9552 (83ca0)
- deps:
- expect:
- mock:
- Inject helpers after hashbang if present - by @sheremet-va in #9545 (65432)
- spy:
- Fallback to object accessor if descriptor's value is
undefined- by @sheremet-va in #9511 (6f181) - Throw correct errors when shorthand methods are used on a class - by @sheremet-va in #9513 (5d0fd)
- Fallback to object accessor if descriptor's value is
View changes on GitHub
v4.1.0-beta.2
🚀 Features
- Expose matcher types - by @sheremet-va in #9448 (3e4b9)
- Add
toTestSpecificationto reported tasks - by @sheremet-va in #9464 (1a470) - Show a warning if
vi.mockorvi.hoistedare declared outside of top level of the module - by @sheremet-va in #9387 (5db54) - Track and display expectedly failed tests (.fails) in UI and CLI - by @Copilot, sheremet-va and @sheremet-va in #9476 (77d75)
- Support tags - by @sheremet-va in #9478 (de7c8)
- browser:
- Add
filterNodeoption to prettyDOM for filtering browser assertion error output - by @Copilot, sheremet-va and @sheremet-va in #9475 (d3220) - Support playwright persistent context - by @hi-ogawa, Claude Opus 4.5 and @sheremet-va in #9229 (f865d)
- Add
- cli:
- Add @bomb.sh/tab completions - by @AmirSa12 and @sheremet-va in #8639 (200f3)
- experimental:
- Option to disable the module runner - by @sheremet-va and @AriPerkkio in #9210 (9be61)
- ui:
🐞 Bug Fixes
- Deprecate unused types in matcher context - by @sheremet-va in #9449 (20f87)
- coverage:
thresholds.autoUpdateto preserve ending whitespace - by @AriPerkkio in #9436 (7e534) - spy: Support deep partial in vi.mocked - by @j2h30728 in #8152 and #9493 (71cb5)
- ui: Process artifact attachments when generating HTML reporter - by @macarie in #9472 (96eb9)
View changes on GitHub
v4.0.18
🚀 Experimental Features
- experimental: Add
onModuleRunnerhook toworker.init- by @sheremet-va in #9286 (ea837)
🐞 Bug Fixes
- Use
meta.urlincreateRequire- by @sheremet-va in #9441 (e0572) - browser: Hide injected data-testid attributes - by @sheremet-va in #9503 (f8989)
- ui: Process artifact attachments when generating HTML reporter - by @macarie in #9472 (22543)
View changes on GitHub
v4.1.0-beta.1
🚀 Features
- Return a disposable from doMock() - by @kirkwaiblinger in #9332 (e3e65)
- Added chai style assertions for spying - by @ronnakamoto and @sheremet-va in #8842 (841df)
- Update to sinon/fake-timers v15 and add
setTickModeto timer controls - by @atscott and @sheremet-va in #8726 (4b480) - api:
- Support tests starting or ending with
testinexperimental_parseSpecification- by @jgillick and Jeremy Gillick in #9235 (2f367) - Add filters to
createSpecification- by @sheremet-va in #9336 (c8e6c) - Expose
runTestFilesas alternative torunTestSpecifications- by @sheremet-va in #9443 (43d76)
- Support tests starting or ending with
- browser:
- coverage:
- Support
ignore start/stopignore hints - by @AriPerkkio in #9204 (e59c9)
- Support
- experimental:
- Add
onModuleRunnerhook toworker.init- by @sheremet-va in #9286 (e977f)
- Add
- runner:
- Enhance
retryoptions - by @MazenSamehR, Matan Shavit, @AriPerkkio and @sheremet-va in #9370 (9e4cf)
- Enhance
🐞 Bug Fixes
- Deprecate several vitest/* entry points - by @sheremet-va in #9347 (fd459)
- Use
meta.urlincreateRequire- by @sheremet-va in #9441 (e3422) - Preact browser mode init example of render function not async - by @WuMingDao in #9375 (2bea5)
- browser: Avoid updating screenshots when
toMatchScreenshotpasses - by @macarie in #9289 (46aab) - coverage: Infer transform mode for uncovered files - by @AriPerkkio in #9435 (f3967)
- deps: Update all non-major dependencies - by @hi-ogawa in #9192 (90c30)
View changes on GitHub
v4.0.17
🚀 Experimental Features
- Support openTelemetry for browser mode - by @hi-ogawa in #9180 (1ec3a)
- Support TRACEPARENT and TRACESTATE environment variables for OpenTelemetry context propagation - by @Copilot, hi-ogawa and @hi-ogawa in #9295 (876cb)
🐞 Bug Fixes
- Improve asymmetric matcher diff readability by unwrapping container matchers - by @Copilot, sheremet-va, hi-ogawa and @hi-ogawa in #9330 (b2ec7)
- Improve runner error when importing outside of test context - by @sheremet-va in #9335 (2dd3d)
- Replace crypto.randomUUID to allow insecure environments (fix #9… - by @plusgut in #9339 and #9 (e6a3f)
- Handle null options in
addEventHandler#9371 - by @ThibautMarechal in #9372 and #9371 (40841) - Typo in browser.provider error - by @deammer in #9394 (4b67f)
- browser:
- Fix
process.envandimport.meta.envdefines in inline project - by @hi-ogawa in #9239 (b70c9) - Fix upload File instance - by @hi-ogawa in #9294 (b6778)
- Fix invalid project token for artifacts assets - by @hi-ogawa in #9321 (caa7d)
- Log
ErrorEvent.messagewhen unhandledErrorEvent.erroris null - by @hi-ogawa in #9322 (5d84e) - Support
fileParallelismon an instance - by @sheremet-va in #9328 (15006)
- Fix
- coverage:
- Remove unnecessary
istanbul-lib-source-mapsusage - by @AriPerkkio in #9344 (b0940) - Apply patch from istanbuljs/istanbuljs#837 - by @AriPerkkio and sapphi-red in #9413 and #837 (e05ce)
- Remove unnecessary
- fsModuleCache:
- Don't store importers in cache - by @sheremet-va in #9422 (75136)
- Add importers alongside importedModules - by @sheremet-va in #9423 (59f92)
- mocker:
- pool:
- Validate environment options when reusing the worker - by @sheremet-va in #9349 (a8a88)
- Handle worker start failures gracefully - by @AriPerkkio in #9337 (200da)
- reporter:
- Report test module if it failed to run - by @sheremet-va in #9272 (c7888)
- runner:
- Respect nested test.only within describe.only - by @Ujjwaljain16 in #9021 and #9213 (55d5d)
- typecheck:
- Improve error message when tsc outputs help text - by @Ujjwaljain16 in #9214 (7b10a)
- ui:
- webdriverio:
- Fall back to WebDriver Classic #9244 - by @JustasMonkev in #9373 and #9244 (c23dd)