Packages

@vitest/spy

5.0.5 · 15 Oct 2026MIT202.7M / weekRepositoryHomepagenpmAtom feed

Your version

1.0.0

major4 Dec 2023Where it was published

1.6.1 is the newest release of 1.x.

In short

13 breaking1 removed21 new3 faster66 fixed4 internal

  • breaking

    Add support for pool and poolOptions, remove old flags

  • breaking

    Support multiple parallel child_process

  • breaking

    Make snapshots more visually pleasing

  • breaking

    Set vitest peer 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 pool and poolOptions, remove old flags

  • breaking

    Support multiple parallel child_process

  • breaking

    Make snapshots more visually pleasing

  • breaking

    Set vitest peer 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 - use expect().toMatchObject() in that case

  • breaking

    runner: Correctly process custom tasks, update runner hooks naming

  • breaking

    coverage: glob based coverage thresholds

  • breaking

    coverage: Use transformMode and workspace project based source maps

  • breaking

    coverage: Enable coverage.all by 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 hints

  • expect: Support expect.closeTo api

  • expect: 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

  • nextTick mocking error message to mention correct config option

  • Export 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 expect

  • Apply serializer to Error instance for thrown snapshot

  • Throw 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 retry and bail from test config file

  • Respect 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-format as a sibling dependency

  • browser: 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 stdin when in run mode

  • config: Type issue of pool and poolMatchGlobs in defineConfig

  • coverage: thresholdAutoUpdate to detect zero limits

  • coverage: 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.freeze breaks toEqual

  • expect: 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 error option 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.hoisted if assigned

  • vitest: 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-update v9

  • Close pool early in run-mode

  • coverage-istanbul: all: true instruments already instrumented files