Vitest v2.1.0stable Released Sep 12, 2024
โš ๏ธ Breaking Change Impact Score: 7/10

Vitest v2.1.0 โ€” Release Notes & Engineering Impact

Source available โ€” automated, not human-reviewed

Component: vitest ยท Channel: stable. Automated analysis, not a compatibility certification. How this works.

Analysis updated: 2026-11-01.

Breaking-change evidence from the source

  • Potential Breaking Change - **workspace**:
Read the original context โ†—
Source flags breaking changes โ€” review applicability
๐Ÿ“„ .MD
โšก Executive Summary (TL;DR)

Vitest v2.1.0. Source highlight: This release makes another big change to the Browser Mode by introducing locators API:

Who Does This Impact? (Role-Based Analysis)

๐Ÿ’ป Software Engineers & Devs

Check the source notes against the package and APIs you use before upgrading.

๐Ÿ“Š Product & Engineering Leads

Use the documented changes to assess relevance to your product; release frequency alone is not a quality measure.

โš™๏ธ DevOps & Security

Verify the target version, runtime requirements and rollback procedure in the official documentation.

โš ๏ธ Breaking Changes & Deprecations (1)

  • Potential Breaking Change - **workspace**:

โœจ New Features & Capabilities (6)

  • Make spec into a class instead of a tuple &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6355 <samp>(874a1)</samp>
  • Move page.config to server.config, add more docs &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6252 <samp>(af2b8)</samp>
  • Make iframe scalable, improve documentation &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6257 <samp>(74ca1)</samp>
  • Introduce built-in locators &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6084 <samp>(3347f)</samp>
  • Support v8 coverage &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6273 <samp>(34199)</samp>
  • Support `userEvent.upload` in playwright provider &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6442 <samp>(cf148)</samp>

๐Ÿ”ง Bug Fixes & Patches (6)

  • Correctly resolve nested mocks with `index` file &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6266 <samp>(081cf)</samp>
  • Don't panic when coverage.reporter is a string &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6267 <samp>(7b37d)</samp>
  • Align RawMatcherFn type definition with Jest &nbsp;-&nbsp; by @wheresrhys in https://github.com/vitest-dev/vitest/issues/6351 <samp>(d09f0)</samp>
  • Cjs build of vite node server &nbsp;-&nbsp; by @AkaraChen in https://github.com/vitest-dev/vitest/issues/6389 <samp>(12e70)</samp>
  • Allow inlining vite's cached dependencies &nbsp;-&nbsp; by @chriswheeldon-peakon in https://github.com/vitest-dev/vitest/issues/6284 <samp>(03208)</samp>
  • Print unexpected error message if peer dependencies have a different version &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6446 <samp>(b992b)</samp>
๐Ÿ“„ View Raw Release Notes (Original Developer Log)
This release makes another big change to the Browser Mode by introducing [locators API](https://vitest.dev/guide/browser/locators.html): ```ts test('renders blog posts', async () => { const screen = page.render(<Blog />) await expect.element(screen.getByRole('heading', { name: 'Blog' })).toBeInTheDocument() const [firstPost] = screen.getByRole('listitem').all() await firstPost.getByRole('button', { name: 'Delete' }).click() expect(screen.getByRole('listitem').all()).toHaveLength(3) }) ``` You can use either [vitest-browser-vue](https://github.com/vitest-dev/vitest-browser-vue), [vitest-browser-svelte ](https://github.com/vitest-dev/vitest-browser-svelte) or [vitest-browser-react](https://github.com/vitest-dev/vitest-browser-react) to render components and make assertions using locators. Locators are also available on the `page` object from `@vitest/browser/context`. ### Potential Breaking Change - **workspace**: - Correctly resolve workspace globs and file paths &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6316 [<samp>(afdcb)</samp>](https://github.com/vitest-dev/vitest/commit/afdcb8f2) - This changes how the custom glob pattern in the workspace config is treated. _Any_ file matching the glob is considered a Vitest config file. Any folder matching the glob pattern is treated as a workspace project and is subject to the regular config resolution (single `vitest.config.ts` or `vite.config.ts` inside the folder) - For example, `projects/*` will match anything inside the `projects` folder. If it's a folder, we try to find the config inside that folder (if there is none, it is still treated as a project with the default config). If it's a file, it will be treated as a Vitest config. `projects/**/*` previously would assume that you only wanted to have folders as projects, but now it will match _every single file_ inside`projects`. - This change doesn't affect non-glob usage. ### &nbsp;&nbsp;&nbsp;๐Ÿš€ Features - **api**: - Make spec into a class instead of a tuple &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6355 [<samp>(874a1)</samp>](https://github.com/vitest-dev/vitest/commit/874a121e) - **browser**: - Move page.config to server.config, add more docs &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6252 [<samp>(af2b8)</samp>](https://github.com/vitest-dev/vitest/commit/af2b813c) - Make iframe scalable, improve documentation &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6257 [<samp>(74ca1)</samp>](https://github.com/vitest-dev/vitest/commit/74ca11a4) - Introduce built-in locators &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6084 [<samp>(3347f)</samp>](https://github.com/vitest-dev/vitest/commit/3347f83e) - Support v8 coverage &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6273 [<samp>(34199)</samp>](https://github.com/vitest-dev/vitest/commit/34199bdf) - Support `userEvent.upload` in playwright provider &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6442 [<samp>(cf148)</samp>](https://github.com/vitest-dev/vitest/commit/cf148645) - Support `--inspect` &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6433 [<samp>(0499a)</samp>](https://github.com/vitest-dev/vitest/commit/0499a315) - Support `--inspect-brk` &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6434 [<samp>(7ab0f)</samp>](https://github.com/vitest-dev/vitest/commit/7ab0f4a8) - **cli**: - Extend existing list command to output only a list of file names &nbsp;-&nbsp; by @Ma-hawaj and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6392 [<samp>(008f0)</samp>](https://github.com/vitest-dev/vitest/commit/008f00b2) - **coverage**: - Add `--exclude-after-remap` &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6309 [<samp>(5932a)</samp>](https://github.com/vitest-dev/vitest/commit/5932a7f9) - **mocker**: - Introduce @vitest/mocker package, allow `{ spy: true }` instead of a factory &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6289 [<samp>(95f02)</samp>](https://github.com/vitest-dev/vitest/commit/95f0203f) - **vitest**: - Add "provide" option &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6253 [<samp>(4409d)</samp>](https://github.com/vitest-dev/vitest/commit/4409d779) - Add return type and promisable mockFactory &nbsp;-&nbsp; by @syi0808 and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6139 [<samp>(f5e0b)</samp>](https://github.com/vitest-dev/vitest/commit/f5e0b987) - Add `vi.advanceTimersToNextFrame` &nbsp;-&nbsp; by @bnjm and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6347 [<samp>(8ff63)</samp>](https://github.com/vitest-dev/vitest/commit/8ff63560) - Allow env to be stubbed to undefined &nbsp;-&nbsp; by @JSanchezIO and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6359 [<samp>(c3b27)</samp>](https://github.com/vitest-dev/vitest/commit/c3b2757c) - Migrate from `fast-glob` to `tinyglobby` &nbsp;-&nbsp; by @SuperchupuDev in https://github.com/vitest-dev/vitest/pull/6274 [<samp>(c321a)</samp>](https://github.com/vitest-dev/vitest/commit/c321a3fd29902fa9295fe219816381884c40a8cd) ### &nbsp;&nbsp;&nbsp;๐Ÿž Bug Fixes - Correctly resolve nested mocks with `index` file &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6266 [<samp>(081cf)</samp>](https://github.com/vitest-dev/vitest/commit/081cfe03) - Don't panic when coverage.reporter is a string &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6267 [<samp>(7b37d)</samp>](https://github.com/vitest-dev/vitest/commit/7b37d27b) - Align RawMatcherFn type definition with Jest &nbsp;-&nbsp; by @wheresrhys in https://github.com/vitest-dev/vitest/issues/6351 [<samp>(d09f0)</samp>](https://github.com/vitest-dev/vitest/commit/d09f00c7) - Cjs build of vite node server &nbsp;-&nbsp; by @AkaraChen in https://github.com/vitest-dev/vitest/issues/6389 [<samp>(12e70)</samp>](https://github.com/vitest-dev/vitest/commit/12e702bd) - Allow inlining vite's cached dependencies &nbsp;-&nbsp; by @chriswheeldon-peakon in https://github.com/vitest-dev/vitest/issues/6284 [<samp>(03208)</samp>](https://github.com/vitest-dev/vitest/commit/03208017) - Print unexpected error message if peer dependencies have a different version &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6446 [<samp>(b992b)</samp>](https://github.com/vitest-dev/vitest/commit/b992b346) - Ignore importer when resolving Vitest &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6469 [<samp>(0b447)</samp>](https://github.com/vitest-dev/vitest/commit/0b447226) - `expect.getState().testPath` always returns correct path &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6472 [<samp>(ac698)</samp>](https://github.com/vitest-dev/vitest/commit/ac698b1c) - UserEvent works consistently between providers &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6480 [<samp>(0b4da)</samp>](https://github.com/vitest-dev/vitest/commit/0b4da69e) - **browser**: - Print correct stack trace for unhandled errors &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6134 [<samp>(1da6c)</samp>](https://github.com/vitest-dev/vitest/commit/1da6cebe) - Use documentElement as the root for selector &nbsp;-&nbsp; by @sheremet-va [<samp>(d8077)</samp>](https://github.com/vitest-dev/vitest/commit/d807767f) - Keep querying elements even if locator is created with elementLocator, add pubic @vitest/browser/utils &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6296 [<samp>(30dc5)</samp>](https://github.com/vitest-dev/vitest/commit/30dc5793) - Produce valid config file if preview provider is used &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6305 [<samp>(7f0ae)</samp>](https://github.com/vitest-dev/vitest/commit/7f0ae292) - Correctly run in-source tests in the browser &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6440 [<samp>(c8531)</samp>](https://github.com/vitest-dev/vitest/commit/c853126e) - Exclude missed packages from optimization, print help message &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6445 [<samp>(8d883)</samp>](https://github.com/vitest-dev/vitest/commit/8d883cf0) - Define mocker as a dependency &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6476 [<samp>(9560a)</samp>](https://github.com/vitest-dev/vitest/commit/9560ab7f) - **coverage**: - Warn if `vitest` and `@vitest/*` versions don't match &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6317 [<samp>(e662c)</samp>](https://github.com/vitest-dev/vitest/commit/e662c7b2) - V8 to support source maps with multiple sources &nbsp;-&nbsp; by @AriPerkkio and @sheremet-va in https://github.com/vitest-dev/vitest/issues/6120 [<samp>(1f6cb)</samp>](https://github.com/vitest-dev/vitest/commit/1f6cb59f) - V8 to warn instead of crash when conversion fails &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6318 [<samp>(91dea)</samp>](https://github.com/vitest-dev/vitest/commit/91dea8c1) - Use project specific `vitenode` for uncovered files &nbsp;-&nbsp; by @AriPerkkio in https://github.com/vitest-dev/vitest/issues/6044 [<samp>(da52d)</samp>](https://github.com/vitest-dev/vitest/commit/da52d23f) - **runner**: - Use `performance.now` instead of `Date.now` for duration &nbsp;-&nbsp; by @LuciNyan in https://github.com/vitest-dev/vitest/issues/6382 [<samp>(fe489)</samp>](https://github.com/vitest-dev/vitest/commit/fe489432) - Async assertion auto await should timeout &nbsp;-&nbsp; by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6391 [<samp>(ad6e7)</samp>](https://github.com/vitest-dev/vitest/commit/ad6e72fc) - **snapshot**: - Reject multiple `toMatchInlineSnapshot` updates at the same location &nbsp;-&nbsp; by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6332 [<samp>(1606f)</samp>](https://github.com/vitest-dev/vitest/commit/1606f34f) - Improve inline snapshot inside loop rejection &nbsp;-&nbsp; by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6339 [<samp>(e0368)</samp>](https://github.com/vitest-dev/vitest/commit/e03683c5) - **typecheck**: - Run both runtime and typecheck tests if `typecheck.include` overlaps with `include` &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6256 [<samp>(153ff)</samp>](https://github.com/vitest-dev/vitest/commit/153ff01b) - **types**: - Allow Callbacks Passed to before*/after* to Return Anything &nbsp;-&nbsp; by @LuciNyan in https://github.com/vitest-dev/vitest/issues/6393 [<samp>(f6217)</samp>](https://github.com/vitest-dev/vitest/commit/f6217a22) - **ui**: - Remove "filters" flickering &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6463 [<samp>(0223b)</samp>](https://github.com/vitest-dev/vitest/commit/0223bb79) - Render project name consistently &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6329 [<samp>(94a18)</samp>](https://github.com/vitest-dev/vitest/commit/94a186ec) - **vite-node**: - Disable watcher if hmr is disabled &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6251 [<samp>(c51c6)</samp>](https://github.com/vitest-dev/vitest/commit/c51c67aa) - Fix watch on vite 6 &nbsp;-&nbsp; by @hi-ogawa in https://github.com/vitest-dev/vitest/issues/6422 [<samp>(c3ac4)</samp>](https://github.com/vitest-dev/vitest/commit/c3ac43c1) - **vitest**: - Update json reporter output &nbsp;-&nbsp; by @Emiyaaaaa in https://github.com/vitest-dev/vitest/issues/6064 [<samp>(c9979)</samp>](https://github.com/vitest-dev/vitest/commit/c997937b) - Add more type guards for --merge-reports &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6307 [<samp>(0a5d8)</samp>](https://github.com/vitest-dev/vitest/commit/0a5d8169) - Always resolve vitest to the root version &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6369 [<samp>(163d7)</samp>](https://github.com/vitest-dev/vitest/commit/163d7624) - Dispose vmForks listeners to avoid memory leak &nbsp;-&nbsp; by @sheremet-va in https://github.com/vitest-dev/vitest/issues/6448 [<samp>(2673c)</samp>](https://github.com/vitest-dev/vitest/commit/2673c3bb) ##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/vitest-dev/vitest/compare/v2.0.5...v2.1.0)