This is a beta release for upcoming 1.0.0 version. Use beta
dist-tag when installing Vitest: npm install --save-dev vitest@beta
.
🚨 Breaking Changes
- Support multiple parallel
child_process
- by @AriPerkkio in #3925 (8b4a4)- If you have to disable threads (if you use
canvas
package, for example), this should improve your speed tremendously. useFakeTimers()
no longer automatically mocksprocess.nextTick
. Users can still mock it by explicitly specifyinguseFakeTimers({ toFake: ['nextTick'] })
- If you have to disable threads (if you use
- Add support for
pool
andpoolOptions
, remove old flags - by @AriPerkkio in #4172 (114a9)- This removes a lot of configuration options to make it easier to configure the runner to your needs. Please, have a look at migration examples if you rely on
--threads
or other related flags.--threads
is now--pool=threads
--no-threads
is now--pool=forks
--single-thread
is now--poolOptions.threads.singleThread
--experimental-vm-threads
is now--pool=vmThreads
--experimental-vm-worker-memory-limit
is now--poolOptions.vmThreads.memoryLimit
--isolate
is now--poolOptions.<pool-name>.isolate
andbrowser.isolate
test.maxThreads
is nowtest.poolOptions.<pool-name>.maxThreads
test.minThreads
is nowtest.poolOptions.<pool-name>.minThreads
test.useAtomics
is nowtest.poolOptions.<pool-name>.useAtomics
test.poolMatchGlobs.child_process
is nowtest.poolMatchGlobs.forks
test.poolMatchGlobs.experimentalVmThreads
is nowtest.poolMatchGlobs.vmThreads
- This removes a lot of configuration options to make it easier to configure the runner to your needs. Please, have a look at migration examples if you rely on
- Make snapshots more visually pleasing by @sheremet-va in #3961
- This will probably cause a lot of test mismatches. Quotes in snapshots are no longer escaped, and all snapshots use backtick quotes (`) even if the string is just a single line. Please, read the PR description for a way to use the previous behavior if you have problems upgrading.
- runner: Correctly process custom tasks, update runner hooks naming by @sheremet-va in #4076
- This PR updates the names for most of the methods on a custom runner (Test -> Task).
- It also improves the flow for creating your custom tasks like benchmarks using
createTaskCollector
utility. This is primarily an advanced API for library authors. - If you use
@vitest/snapshot
separately, you will also need to update its usage. You no longer need to extendSnapshotClient
to overrideequalityCheck
method - just pass it down as anisEqual
option. Also some of the public API methods were renamed for clarity. - If you have any questions, please, read the PR description first.
🚀 Features
- Include "vitest" in the process name - by @sheremet-va in #4191 (404c1)
- runner: Improve text.extend types - by @Dunqing in #4176 (bbb43)
- vitest: Expose getBenchFn, getBenchOptions - by @sheremet-va in #4208 (8e5e4)
🐞 Bug Fixes
- Don't optimize vue when using optimizer - by @sheremet-va (4e941)
- Overwrite global URL with environment's - by @sheremet-va in #4164 (6a66b)
- Correctly resolve external dependencies loaded by custom environments - by @sheremet-va in #4196 (39647)
- Add multiple globals in VM+JSDOM - by @nstepien in #4199 and #4202 (fc947)
- Ignore "plugins" field in snapshotFormat option - by @sheremet-va in #4204 (db1ff)
nextTick
mocking error message to mention correct config option - by @AriPerkkio in #4215 (98fe3)- happy-dom:
- Don't crash when calling useFakeTimers with empty config - by @sheremet-va in #4214 (2e1a1)
- runner:
- vitest:
- Make @types/node optional - by @sheremet-va in #4210 (a5383)
- Inline chai types instead of using @types/chai - by @sheremet-va in #4209 (5f477)
- Don't initialize globalSetup if workspace doesn't run tests - by @sheremet-va in #4213 (06461)