@vitest/expect
5.0.5 · 15 Oct 2026MIT151.9M / weekRepositoryHomepagenpmAtom feed
1.6.1 is the newest release of 1.x.
In short
13 breaking1 removed21 new3 faster66 fixed4 internal
- breaking
Add support for
poolandpoolOptions, remove old flags - breaking
Support multiple parallel
child_process - breaking
Make snapshots more visually pleasing
- breaking
Set
vitestpeer dependency range for sub packages - breaking
Bump minimum node version to 18 and match Vite 5 requirement
- breaking
Remove deprecated node loader
- breaking
Move browser providers to @vitest/browser package
- breaking
Remove EnhancedSpy type, deprecate SpyInstance, improve mocks and vi documentation
Release note
Vitest 1.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
- breaking
Add support for
poolandpoolOptions, remove old flags - breaking
Support multiple parallel
child_process - breaking
Make snapshots more visually pleasing
- breaking
Set
vitestpeer dependency range for sub packages - breaking
Bump minimum node version to 18 and match Vite 5 requirement
- breaking
Remove deprecated node loader
- breaking
Move browser providers to @vitest/browser package
- breaking
Remove EnhancedSpy type, deprecate SpyInstance, improve mocks and vi documentation
- breaking
expect().toContain()can handle classList, Node.contains, and any array-like structure. This means you cannot use it to check if one object is a subset of another - useexpect().toMatchObject()in that case - breaking
runner: Correctly process custom tasks, update runner hooks naming
- breaking
coverage: glob based coverage thresholds
- breaking
coverage: Use
transformModeand workspace project based source maps - breaking
coverage: Enable
coverage.allby default
Features
Add Marko example and include code coverage for Marko files
Update magic-string
Implement provide/inject API to transfer data from the main thread
Improve expectTypeOf error messages
Add test.sequential() api
Allow custom pools
Add --project option to limit what projects are running
benchmark: Move importTinybench to runner
browser: Support "none" provider and update lit example to use it
coverage: Support
/* v8 ignore...ignore hintsexpect: Support
expect.closeToapiexpect: Compare URL objects by href
snapshot: Add option to configure snapshot directory
vite-node: Support import.meta.hot.off for vite 5
vitest: Expose getBenchFn, getBenchOptions
vitest: Run typecheck during tests
vitest: Filter stacktraces
vitest: Expose execArgv to the different pools
Bug Fixes
Add multiple globals in VM+JSDOM
Ignore "plugins" field in snapshotFormat option
nextTickmocking error message to mention correct config optionExport VitestUtils interface
Assertion diff message handle non-writable sub-properties
Don't bundle import from rollup
Support accessing fixture at same index of dependency fixture
Make asynchronous fixtures work concurrently
Coverage.100 crash when using as an cli argument
Support typechecking with Yarn PnP
Support accessing task from test context without accessing fixtures
Copy custom asymmetric matchers to local
expectApply serializer to
Errorinstance for thrown snapshotThrow an error when running "vitest typecheck"
Don't expand snapshot diff by default
Handle errors thrown in fixtures
Default --open to !process.env.CI
Disable ESBuild when user config disables it
Inherit concurrent/sequential in nested suites
Provide customTesters to asymmetric matchers
Apply
retryandbailfrom test config fileRespect trailing slash when filtering by file path
Date prototype when using setSystemTime
BrowserTestRunner called incorrect super methods
Set process name for idle workers
browser: Improve error handling and don't rely on Node.js builtin modules in browser mode
browser: Disable hijacking ES modules until vi.mock is implemented
browser: Add vitest/ imports to entries
browser: Wait until vite finishes prebundling of vitest dependencies
browser: Allow for
pretty-formatas a sibling dependencybrowser: Don't go into an infinite reload loop, don't fail if "error" event is caught
browser: Respect "server" option in vite config
cli: Do not capture
stdinwhen in run modeconfig: Type issue of
poolandpoolMatchGlobsin defineConfigcoverage:
thresholdAutoUpdateto detect zero limitscoverage: Exclude files and directories starting with dot by default
coverage: Improve memory usage by writing temporary files on file system
expect: Publish types file
expect:
Object.freezebreakstoEqualexpect: Publish semantically correct chai types
expect: Print full error if promise is rejected
expect: Don't fail when using jest expect
happy-dom: Don't crash when calling useFakeTimers with empty config
jsdom: Don't go into an infinite recusion when calling atob
runner: Fixture needs to be initialized for each test
runner: Nested tests should throw errors
- removed
runner: Removes deprecated
erroroption from TaskResult runner: Preserve fixtures when calling runif and skipif
runner: PassWithNoTests option not work
vite-node: Have a separate cache for web/ssr transforms
vite-node: Mjs files watch not work
vitest: Make @types/node optional
vitest: Inline chai types instead of using @types/chai
vitest: Don't initialize globalSetup if workspace doesn't run tests
vitest: Deduplicate vitest when running globally or in a workspace
vitest: Print file path instead of "unknown test" when logging
vitest: Failed to load custom environment from js/ts file
vitest: Support assets in new URL in Vite 5
vitest: Correctly hoist
vi.hoistedif assignedvitest: Run globalSetup from the root config even if it's not in a workspace
vitest: Pass correct mode in vitest config function
vitest: Throw an error if vitest is imported using require()
vitest: Use correct type for defineProject to allow usage in mergeConfig
vitest: Throw an error if Vite wasn't able to resolve aliased path
vitest: Improve vi.waitUntil type to excude falsy types
vitest: Add import-meta.d.ts
vitest: Correctly support CSS variable when using happy-dom
vitest: Pass correct server options in workspace
vitest: Independently mock each instance's methods for mocked class
vm: Remove sequencer usage from createVmThreadsPool function
Performance
Update
log-updatev9Close pool early in run-mode
coverage-istanbul:
all: trueinstruments already instrumented files