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.
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.
OptionalopenTelemetry?: { enabled: boolean; sdkPath?: string }OptionalprintImportBreakdown?: booleanShow imports (top 10) that take a long time.
Enabling this will also show a breakdown by default in UI, but you can always press a button to toggle it.
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 the test specific number of times if it fails.
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.
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.