OptionalallowAllow tests and suites that are marked as only
OptionalattachmentsDirectory path for storing attachments created by context.annotate
OptionalbailStop test execution when given number of tests have failed.
Name of the browser
OptionalchaiModify default Chai config. Vitest uses Chai for expect and assert matches.
https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
OptionalclearWill call .mockClear() on all spies before each test
OptionalcssIndicates if CSS files should be processed.
When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
OptionaldetectDetect asynchronous resources leaking from the test file.
OptionaldiffPath to a module which has a default export of diff config.
OptionaldirBase directory to scan for the test files
OptionaldisableBy default, Vitest automatically intercepts console logging during tests for extra formatting of test file, test title, etc... This is also required for console log preview on Vitest UI. However, disabling such interception might help when you want to debug a code with normal synchronous terminal console logging.
This option has no effect on browser pool since Vitest preserves original logging on browser devtools.
OptionalenvCustom environment variables assigned to process.env before running tests.
OptionalexcludeExclude globs for test files
OptionalexecPass additional arguments to node process when spawning the worker.
See Command-line API | Node.js for more information.
Set to process.execArgv to pass all arguments of the current process.
Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103
OptionalexpandShow full diff when snapshot fails instead of a patch.
OptionalexpectConfiguration options for expect() matches.
Optionalpoll?: { interval?: number; timeout?: number }Default options for expect.poll()
Optionalinterval?: numberPolling interval in milliseconds
Optionaltimeout?: numberTimeout in milliseconds
OptionalrequireAssertions?: booleanThrow an error if tests don't have any expect() assertions.
Optional ExperimentalexperimentalExperimental features
OptionalfsModuleCache?: booleanEnable caching of modules on the file system between reruns.
OptionalfsModuleCachePath?: stringPath relative to the root of the project where the fs module cache will be stored.
OptionalimportDurations?: {Configure import duration collection and display.
The limit option controls how many imports to collect and display.
The print option controls CLI terminal output.
UI can always toggle the breakdown display regardless of print setting.
OptionalfailOnDanger?: booleanFail the test run if any import exceeds the danger threshold.
When failing, the breakdown is always printed regardless of print setting.
Optionallimit?: numberMaximum number of imports to collect and display.
Optionalprint?: boolean | "on-warn"When to print import breakdown to CLI terminal after tests finish.
true: Always printfalse: Never print (default)'on-warn': Print only when any import exceeds the warn thresholdOptionalthresholds?: { danger?: number; warn?: number }Duration thresholds in milliseconds for coloring and warnings.
Optionaldanger?: numberDanger threshold - imports exceeding this are shown in red.
Optionalwarn?: numberWarning threshold - imports exceeding this are shown in yellow/orange.
OptionalnodeLoader?: booleanIf module runner is disabled, Vitest uses a module loader to transform files to support
import.meta.vitest and vi.mock.
If you don't use these features, you can disable this.
This option only affects loader.load method, Vitest always defines a loader.resolve to populate the module graph.
OptionalopenTelemetry?: { browserSdkPath?: string; enabled: boolean; sdkPath?: string }OptionalvcsProvider?: string | VCSProviderCustom provider for detecting changed files. Used with the --changed flag
to determine which files have been modified.
By default, Vitest uses Git to detect changed files. You can provide a custom
implementation of the VCSProvider interface to use a different version control system.
OptionalviteModuleRunner?: booleanControls whether Vitest uses Vite's module runner to run the code or fallback to the native import.
If Node.js cannot process the code, consider registering module loader via execArgv.
OptionalfakeOptions for @sinon/fake-timers
OptionalfileShould all test files run in parallel. Doesn't affect tests running in the same file.
Setting this to false will override maxWorkers option to 1.
OptionalglobalsRegister apis globally
OptionalglobalPath to global setup files
Optionalheadlessenable headless mode
OptionalhideHide logs for skipped tests
OptionalhookDefault timeout of a hook in milliseconds
OptionalincludeA list of glob patterns that match your test files.
OptionalincludeInclude globs for in-source test files
OptionalincludeInclude "location" property inside the test definition
OptionalinspectorInspector options. If --inspect or --inspect-brk is enabled, these options will be passed to the inspector.
Optionalenabled?: booleanEnable inspector
Optionalhost?: stringHost to run inspector on
Optionalport?: numberPort to run inspector on
OptionalwaitForDebugger?: booleanWait for debugger to connect before running tests
OptionalisolateRun tests in an isolated environment. This option has no effect on vmThreads pool.
Disabling this option improves performance if your code doesn't rely on side effects.
OptionallocatorsLocator options
OptionallogShow heap usage after each test. Useful for debugging memory leaks.
OptionalmaxA number of tests that are allowed to run at the same time marked with test.concurrent.
OptionalmaxMaximum number or percentage of workers to run tests in.
OptionalmockWill call .mockReset() on all spies before each test
OptionalmodeOptionalnameOptionalonA callback that can return false to ignore an unhandled error
OptionalprintAlways print console stack traces.
OptionalprojectsOptions for projects
OptionalprovideDefine variables that will be returned from inject in the test environment.
OptionalproviderOptionalrestoreWill call .mockRestore() on all spies before each test
OptionalretryRetry configuration for tests.
⚠️ WARNING: Function form is NOT supported in a config file because configurations are serialized when passed to worker threads. Use the function form only in test files directly.
OptionalscreenshotDirectory where screenshots will be saved when page.screenshot() is called If not set, all screenshots are saved to screenshots directory in the same folder as the test file. If this is set, it will be resolved relative to the project root.
OptionalscreenshotShould Vitest take screenshots if the test fails
OptionalsequencerOptionalsetupPath to setup files
OptionalsnapshotPath to a custom snapshot environment module that has a default export of SnapshotEnvironment object.
OptionalsnapshotPaths to snapshot serializer modules.
OptionalstrictShould Vitest throw an error if test has a tag that is not defined in the config.
OptionaltagsDefine tags available in your test files.
If test defines a tag that is not listed here, an error will be thrown.
OptionaltesterPath to the index.html file that will be used to run tests.
OptionaltestDefault timeout of a test in milliseconds
OptionalunstubWill restore all env stubs to their original values before each test
OptionalunstubWill restore all global stubs to their original values before each test
OptionalviewportDefault viewport size
OptionalvmSpecifies the memory limit for worker_thread or child_process before they are recycled.
If you see memory leaks, try to tinker this value.
Construct a type with the properties of T except for those in type K.