Configure options below — the preview updates in real time.

Inclusion & File Resolution

Control which files Vitest includes, excludes, and where it looks for tests.

Glob patterns specifying which test files to execute.

Glob patterns specifying which files to exclude from tests.

Glob patterns to detect files containing in-source tests (e.g. if (import.meta.vitest) blocks).

The base directory for scanning test files. Defaults to the project root.

The root directory of the Vitest project.

Label for the specific project or workspace config (shows in console output).

Environment & Global Setup

Configure the test execution environment and global setup files.

The environment in which tests will run.

GlobalsInjects Vitest APIs (describe, test, expect) globally, acting similarly to Jest.

Files executed before every test file to configure the test runner or test environment.

Files run once before all test suites start, useful for spinning up global databases or servers.

Match specific file globs to different environments as key-value pairs (glob: environment).

Execution, Parallelism & Pooling

Configure worker pools, parallelism, and isolation settings.

Defines the worker pool architecture used to run isolated test environments.

Maximum number of workers to run concurrently. Accepts a number or a percentage string (e.g. 50%).

Minimum number of workers to keep alive.

IsolateIsolate tests by running them in separate worker instances/contexts. Setting to false boosts speed but shares state.
File ParallelismWhether test files should run in parallel.

Flow Control & Timeouts

Control test timeouts, retries, bail behavior, and execution order.

Default timeout for an individual test case in milliseconds.

Default timeout for test hooks (beforeAll, beforeEach, etc.) in milliseconds.

Default timeout to tear down Vitest environments safely in milliseconds.

Stop test execution immediately after the specified number of failed tests. 0 means no bail.

Number of times to automatically retry a failed test.

Pass With No TestsIf true, Vitest will not fail the suite if no matching tests are found.
Allow OnlyAllow .only block tests. Usually disallowed in CI to prevent uncommitted focus tests.

The number of milliseconds after which a test or suite is considered slow and reported as such.

Maximum number of tests and hooks that can run at the same time when using test.concurrent or describe.concurrent.

Shuffle TestsRun tests in random order.

Seed for random shuffle when shuffle is enabled. Defaults to Date.now().

Controls how hooks are executed.

Controls how setup files are executed.

Reporting & Output

Configure test reporters and output behavior.

Custom reporters to format test outputs.

File path where test reports should be dumped (e.g. ./test-results.json).

SilentPrevents console.logs from within tests from printing.
Hide Skipped TestsHides skipped tests from the terminal output.
Print Console TracePrints a stack trace for every console.log inside a test.
Log Heap UsageShows memory heap usage after every test file run (useful for debugging leaks).
Ignore Unhandled ErrorsIf true, unhandled rejections will not crash the test suite.
Disable Console InterceptDisable automatic interception of console logging. Useful for debugging with standard terminal output.
Expand Snapshot DiffShow full diff when snapshot fails instead of a patch.

Coverage

Configure code coverage collection, providers, thresholds, and reporting.

Enable CoverageAutomatically trigger coverage calculation.

The engine generating coverage.

File globs to strictly include in coverage.

File globs to ignore in coverage.

Allowed file extensions for coverage (e.g. .js, .ts).

Cover All FilesForce coverage generation for all matching files, even if untested.
Clean CoverageClean previous coverage directory before running.
Clean On RerunClean coverage on watch reruns.

Directory for dumping coverage outputs.

Coverage report formats to generate.

Report On FailureGenerate reports even if the test run failed.
Allow ExternalAllow coverage of files located outside the project root.
Skip Full CoverageDo not show files with 100% coverage in reports.

Concurrency limit for parsing coverage output. Defaults to min(20, available CPU cores).

Import path if using a custom coverage provider.

Minimum line coverage percentage.

Minimum function coverage percentage.

Minimum branch coverage percentage.

Minimum statement coverage percentage.

Auto-Update ThresholdsUpdate threshold files automatically.
Per-File ThresholdsEnsure thresholds apply per individual file.
Enforce 100% CoverageShorthand to enforce 100% across all metrics.

Watch Mode & Debugging

Configure watch mode, UI dashboard, and debugging options.

Watch ModeEnable watch mode. Enabled by default in interactive environments unless --run is specified. Disabled in CI.

Glob patterns that trigger a test re-run when matching files change.

If these config files change, all tests rerun regardless of caching.

UI DashboardLaunch the Vitest HTML UI dashboard.

Base route for the Vitest UI.

Auto-Open BrowserAutomatically open the browser UI or HTML coverage report.

Mocks, Timers & State Isolation

Configure automatic mock clearing, timer faking, and state isolation.

Clear MocksCall vi.clearAllMocks() automatically before each test.
Reset MocksCall vi.resetAllMocks() automatically before each test.
Restore MocksCall vi.restoreAllMocks() automatically before each test.
Unstub EnvsCall vi.unstubAllEnvs() before each test.
Unstub GlobalsCall vi.unstubAllGlobals() before each test.
Fake Timers: Advance TimeAutomatically increment mocked time based on real system time shifts.

Milliseconds of real time delta for advancing fake timers.

Fake Timers: Clear Native TimersDelegate clearing to respective timer handlers when enabled.

Maximum number of timer loops to prevent infinite loops.

Assertions & Snapshots

Configure assertion behavior, chai settings, and snapshot formatting.

Require AssertionsFail if a test has no assertions.

Interval in milliseconds for polling expect matchers.

Timeout in milliseconds for polling expect matchers.

Chai: Include StackInclude stack traces in assertion errors.
Chai: Show DiffShow diff output in assertion errors.

Threshold length for truncating assertion values in output.

Snapshot: Call toJSONCall toJSON method on objects when serializing snapshots.

Number of indentation spaces for snapshot output.

Maximum depth of serialized snapshot objects.

Maximum width of serialized snapshot arrays.

Snapshot: Print Basic PrototypePrint the prototype for plain objects and arrays in snapshots.
Snapshot: Print Function NamePrint the function name in snapshots.
Snapshot: Escape RegexEscape regex special characters in snapshots.
Snapshot: Escape StringEscape string special characters in snapshots.
Snapshot: HighlightEnable syntax highlighting in snapshot output.
Snapshot: MinifyMinify snapshot output by removing extra whitespace.
Update SnapshotsGlobally overwrite/update snapshots when tests run.

TypeScript & Dependencies

Configure type checking, CSS handling, and dependency resolution.

Enable Type CheckingRun a TypeScript/Vue-TSC checker alongside tests.

The type checker to use.

File globs to include in type checking.

File globs to exclude from type checking.

Type Check Allow JSAllow JavaScript files in type checking.
Ignore Source ErrorsIgnore type errors from source files (only report test file errors).

Path to the tsconfig.json file.

RegExp patterns for files that should return actual CSS and be processed by the Vite pipeline.

RegExp patterns for files that will return an empty CSS file.

Vite-style alias mapping, merged with base resolve.alias. Map alias keys to paths.

Environment Variables & Cache

Set environment variables for tests and configure the cache.

Map of explicit environment variables (process.env.*) to inject during tests.

Enable CacheEnable caching of test results to run longer and failed tests first.

Overrides Vite mode during test execution.

Browser Mode

Configure running tests directly inside a real browser.

Enable Browser TestingEnables browser testing.

The driver for the browser.

HeadlessRun browsers without UI globally.

Path to output failed browser captures.

Screenshot FailuresAutomatically screenshot errors.
Browser IsolateRun browser environments strictly in isolation.

Width of the browser viewport in pixels.

Height of the browser viewport in pixels.

Custom path to inject browser tests.