Skip to content

v2.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 08 Jul 11:40
· 205 commits to main since this release
1b150a3

Vitest 2.0 is here! This release page lists all changes made to the project during the beta. For the migration guide, please refer to the documentation.

🚨 Breaking Changes

  • Simplify mock function generic types and align with jest - by @hi-ogawa in #4784 (a0c1d37)
  • Remove --segfault-retry - by @sheremet-va in #5514 (ed60e)
    • This flag was introduced to combat threads segfaults. Our current recommendation is to use the new default forks pool instead.
  • Run suite hooks in a stack - by @sheremet-va in #5609 (1277d)
    • This feels like a more sensible default. Especially with the new onTestFinished hook. This can make your tests run a little bit slower.
  • Enable coverage.ignoreEmptyLines by default - by @AriPerkkio in #5543 (31994)
    • ⚠️ This change may cause significant differences in your coverage results compared to Vitest v1. These changes are expected as coverage reporting is now more accurate. See #5423 for more details.
  • Add correct location and snapshot fields in json reporter - by @sheremet-va in #5434 (bcccc)
    • Previously, the location field pointed to the error location instead of the test location. Now it is aligned with jest and contains the line and column of a test function, but requires includeTaskLocation to be enabled.
  • Update dependency chai to v5 - by renovate[bot] and @sheremet-va in #5135 (73646)
  • Remove watchExclude - by @patak-dev in #5177 (d7371)
  • Change default pool to 'forks' - by @AriPerkkio in #5047 (7f8f9)
  • --merge-reports to support coverage - by @AriPerkkio in #5736 (b7438)
  • Add promise-based return assertions, do not auto-resolve returned promises - by @sheremet-va in #5749 (5f710)
    • ⚠️ Vitest no longer unwraps promises in spy.mock.returns. If the function is async or returns a promise, it will always succeed and have a Promise in results. To make migration easier, we introduced spy.mock.settledResults that unwraps promises and expect().toHaveResolved() matcher that accepts unwrapped value.
  • Do not exit process if global setup has failed - by @sheremet-va in #5726 (ddb09)
  • Don't exit process if config failed - by @sheremet-va in #5715 (f232f)
  • Add meta to json output - by @sheremet-va in #5802 (dd754)
  • Rename indexScripts to orchestratorScripts in the browser config - by @sheremet-va in #5842 (49f34)
  • Add "vitest list" API to print collected tests without running them - by @sheremet-va in #6013 (583dd)
    • ⚠️ This changes the custom pool API - now requires collectTests method alongside runTests.
  • Remove the empty suite from the runner - by @sheremet-va in #5435 (dbbbe)
  • Support concurrent suites - by @hi-ogawa in #5491 (222ce44)
  • Support overriding exclude in coverage - by @AriPerkkio in #5997 (169bc)
    • ⚠️ Vitest coverage no longer adds test files to exclude patterns if coverage.exclude was overridden in the config. Add your test patterns manually, or merge your overrides with default ones: ['**/my-pattern.js', ...coverageConfigDefaults.exclude]. See https://vitest.dev/config/#coverage-exclude for an example.
  • api:

🚀 Features

Running tresjs example in Vitest BrowserMode

🐞 Bug Fixes

View changes on GitHub