3.0.0
Vitest 3 is here! There are a few breaking changes, but we expect the migration to be smooth. This release page lists all changes made to the project during the beta. For the migration guide, please refer to the documentation.
🚨 Breaking Changes
spy.mockResetchanges - by @Lordfirespeed in https://github.com/vitest-dev/vitest/issues/6426 (db7a8)- Pass down context to test hooks - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7034 (82c2e)
- Support Vite 6 - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7026 (7abe8)
- coverage: Always exclude test files - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7254 (b5268)
- deps: Update fake-timers to v14.0.0 - by @xxzefgh and @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7097 (c98b4)
- expect: Check more properties for error equality - by @hi-ogawa and @sheremet-va in https://github.com/vitest-dev/vitest/issues/5876 (10023)
- runner: Support
describe(..., { shuffle: boolean })and inherit from parent suite - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6670 (aa1da) - snapshot: Reset snapshot state for
retryandrepeats- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6817 (e8ce9) - spy: SpyOn reuses mock if method is already spyed on - by @sheremet-va and @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6464 (b3e43)
- vitest: Don't expose default toFake config - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6288 (e3144)
🚀 Features
- Support inline
diffoptions and supportprintBasicPrototype- by @hi-ogawa, @sheremet-va and Michał Grzegorzewski in https://github.com/vitest-dev/vitest/issues/6740 (39186) - Allow a custom note when calling
ctx.skip()dynamically - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6805 (697c3) - Allow inline workspace configuration - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6923 (562e1)
- Provide the current project to the global setup - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6942 (a5bbc)
- Print project name as a label - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6925 (a3bef)
- Print a deprecation warning if suite or test uses object as the third argument - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7031 (407f1)
- Expose versions from
vitest/nodeentry point and statically on Vitest - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7029 (be8d4) diff.printBasicPrototype: falseby default - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7043 (2b5c5)- Prepare the Vitest API to be stable - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6962 (9a1b5)
- Support Vite v6 in mocker package - by @cexbrayat in https://github.com/vitest-dev/vitest/issues/7058 (96f47)
- Allow multi-browser configuration - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6975 (78b62)
- Add resolved project names to the reporter API - by @userquin in https://github.com/vitest-dev/vitest/issues/7213 (91758)
- Introduce the new reporter API - by @sheremet-va and @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7069 (76662)
- Add
describe.for- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7253 (0ad28) - api:
- Add onBrowserInit event - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7255 (80ce0)
- browser:
- Support
actionTimeoutas playwright provider options - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6984 (e2c29) - Support clipboard api
userEvent.copy, cut, paste- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6769 (843a6) - Implement locator.nth() - by @xeger and @sheremet-va in https://github.com/vitest-dev/vitest/issues/7137 (38458)
- Support
- cli:
- Support excluding projects with
--project=!pattern- by @haines in https://github.com/vitest-dev/vitest/issues/6924 (ebfe9) - Support specifying a line number when filtering tests - by @mzhubail and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6411 (4d94b)
- Support location filters for suites - by @mzhubail in https://github.com/vitest-dev/vitest/issues/7048 (751e2)
- Support excluding projects with
- coverage:
thresholdsto support maximum uncovered items - by @jonahkagan in https://github.com/vitest-dev/vitest/issues/7061 (bde98)
- expect:
- Add
toHaveBeenCalledExactlyOnceWithexpect matcher - by @jacoberdman2147 and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6894 (ff662) - Add
toHaveBeenCalledAfterandtoHaveBeenCalledBeforeutility - by @Barbapapazes and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6056 (85e6f) - Add
toSatisfyasymmetric matcher - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7022 (f691a) - Add
toBeOneOfmatcher - by @zirkelc and @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6974 (3d742)
- Add
- reporter:
- Add support for function type to classname option in the junit reporter - by @jpleclerc, Jean-Philippe Leclerc and @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6839 (dc238)
- reporters:
summaryoption forverboseanddefaultreporters - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6893 (511b7)
- runner:
- Test context can inject values from the config's
provide- by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6813 (85c64) - Add "queued" state - by @sheremet-va and @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6931 (5f8d2)
- Test context can inject values from the config's
- snapshot:
- Provide
configtoresolveSnapshotPath- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6800 (746d8)
- Provide
- ui:
- Allow run individual tests/suites from the UI - by @userquin in https://github.com/vitest-dev/vitest/issues/6641 (d9cc8)
- Make clicking on a test in the UI open the report section and scroll to the test failure if applicable - by @jacoberdman2147 in https://github.com/vitest-dev/vitest/issues/6900 (1bf27)
- Allow hide/show node_modules in module graph tab - by @userquin in https://github.com/vitest-dev/vitest/issues/7217 (50cf6)
- vitest:
- Include
coverageMapin json report - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6606 (9c8f7) - Add
onTestsRerunmethod to global setup context - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6803 (e26e0)
- Include
🐞 Bug Fixes
- Misc fix for vite 6 ecosystem ci - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6867 (80f8b)
- Respect
cacheDirwhen optimizer is enabled - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6910 (0b08b) - Reset runningPromise after
finallyin case there is an error to avoid it getting stuck - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6951 (02194) - Revert support for Vite 6 - by @sheremet-va (fbe5c)
- Support Node 21 - by @sheremet-va (92f7a)
- Don't use
Customtype internally - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7032 (7957f) - Persist cli filters as watch mode file filter - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6955 (cc703)
- Don't use dim color for succeeded tests - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7059 (8a6f5)
- Fix missing chai types - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7149 (6a09c)
cancelCurrentRunawaitsrunningPromise- by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7168 (1dbf5)- Add Locator typings for nth, first and last. - by @xeger in https://github.com/vitest-dev/vitest/issues/7176 (d262e)
- Batch console logs by microtask - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7183 (53d1d)
- Allow
getMockImplementationto return "once" implementation - by @chaptergy in https://github.com/vitest-dev/vitest/issues/7033 (39125) capturePrintErrorlogger duplicate event handlers - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7197 (e89c3)- Allow slots in vitest-browser-vue - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7120 (2319f)
- Reset root workspace project on restart - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7238 (6e518)
- Cleanup
vitest/reportersentrypoint - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7241 (aec0b) - Colors on
forkspool - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7090 (8cab9) - Export
VitestRunnertype fromvitest/runners- by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7240 (9b218) - Return test fn result to runner - by @wmertens in https://github.com/vitest-dev/vitest/issues/7239 (48645)
- Re-apply default conditions if using vite 6 or later - by @thebanjomatic, thebanjomatic and @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7071 (84287)
- Prevent infinite loop on prettyDOM calls - by @tsirlucas in https://github.com/vitest-dev/vitest/issues/7250 (a3a46)
- api:
- Don't report events during
vitest list- by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7257 (1c2b2)
- Don't report events during
- benchmark:
- Disable type testing while benchmarking - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7068 (4e603)
- Rewrite reporter without
log-update- by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7019 (6d23f)
- browser:
- Improve source maps when
vi.mockis present - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6810 (8d179) - Explain TypeScript support in docs and add asymmetric matchers to types - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6934 (ac1a7)
- Fix matchers.d.ts - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6995 (a485b)
- Fix user event state on preview provider - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7041 (8e944)
- Fix provider options types - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7115 (579bd)
- Only use locator.element on last expect.element attempt - by @tsirlucas in https://github.com/vitest-dev/vitest/issues/7139 and https://github.com/vitest-dev/vitest/issues/7152 (847d3)
- Use correct project when filtering
entriesin the browser mode - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7167 (423d6) - Fix
console.timewith fake timers - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7207 (903f3) - Add instance validation to resolve coverage error - by @DevJoaoLopes and @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7231 (1e791)
- Improve source maps when
- coverage:
- Exclude browser mode iframe results - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6905 (e04a1)
- Correct coverage when
isolate: falseis used - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6957 (426ce) - Prevent crash when v8 incorrectly merges static_initializer's - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7150 (cb6db)
- deps:
- Update all non-major dependencies - in https://github.com/vitest-dev/vitest/issues/7085 (8cc92)
- Update all non-major dependencies - in https://github.com/vitest-dev/vitest/issues/7116 (de5ce)
- Update dependency pathe to v2 - in https://github.com/vitest-dev/vitest/issues/7181 (74dbe)
- diff:
- Truncate to avoid crash on diff large objects - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7133 (2a9d6)
- junit:
- Fix testsuites time to be sum of all testsuite items - by @saitonakamura in https://github.com/vitest-dev/vitest/issues/6985 (ca37a)
- pretty-format:
- Support react 19 - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6909 (bd29b)
- reporters:
- Write buffered stdout/stderr on process exit - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6932 (80cde)
- Rewrite
dotreporter withoutlog-update- by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6943 (be969) - Check
--hideSkippedTestsin base reporter - by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6988 (721a5) - Show
retryandrepeatscounts - by @AriPerkkio and @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7004 (3496a)
- runner:
- Long synchronous tasks does not time out - by @ferdodo and @sheremet-va in https://github.com/vitest-dev/vitest/issues/2920 and https://github.com/vitest-dev/vitest/issues/6944 (2fb58)
- Mark tests of
describe.todoas'todo'- by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7171 (1d458)
- snapshot:
- Fix "obsolete" message on snapshot update re-run - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7129 (c2beb)
- Preserve white space of
toMatchFileSnapshot- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7156 (a437b) - Fix obsoleteness check of
toMatchSnapshot("...")- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7126 (ac9ba)
- typecheck:
- Fix typecheck collect on Vite 6 - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6972 (7b35d)
- Use unique temp and tsbuildinfo file for each tsconfig file - by @masnormen in https://github.com/vitest-dev/vitest/issues/7107 and https://github.com/vitest-dev/vitest/issues/7112 (61b30)
- Fix error test case mapping for
@ts-expect-error- by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7125 (27d34)
- types:
- Make parameters non-nullable for Playwright options - by @apple-yagi in https://github.com/vitest-dev/vitest/issues/6989 (fe2a1)
- ui:
- Wrong module graph when generating html.meta.json.gz in browser mode - by @userquin in https://github.com/vitest-dev/vitest/issues/7214 (dccdd)
- Add errors and draft state (*) to the code editor - by @userquin in https://github.com/vitest-dev/vitest/issues/7044 (faca4)
- vite-node:
- Fix error stack on Windows - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6786 (bf7b3)
- Properly normalize file url import - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7087 (31675)
- Fix mandatory node prefix - by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/7179 (b6284)
- watch:
- Don't indicate exit when no matching files - by @sheremet-va and @AriPerkkio in https://github.com/vitest-dev/vitest/issues/7246 (003c0)
- workspace:
extends: truecorrectly inherits all root config properties - by @sheremet-va in https://github.com/vitest-dev/vitest/issues/7232 (798c0)