Allow tests and suites that are marked as only
Optional apiStop test execution when given number of tests have failed.
Optional baseOptional benchmarkModify default Chai config. Vitest uses Chai for expect and assert matches.
https://github.com/chaijs/chai/blob/4.x.x/lib/chai/config.js
Runs tests that are affected by the changes in the repository, or between specified branch or commit hash Requires initialized git repository
false
Will call .mockClear() on all spies before each test
false
Optional cliOptional configIndicates if CSS files should be processed.
When excluded, the CSS files will be replaced with empty strings to bypass the subsequent processing.
Optional exclude?: RegExp | RegExp[]Optional include?: RegExp | RegExp[]Optional modules?: { Optional class{ include: [], modules: { classNameStrategy: false } }
Ignore any unhandled errors that occur
Handling for dependencies inlining or externalizing
Path to a module which has a default export of diff config.
Base directory to scan for the test files
config.root
Use happy-dom
Custom environment variables assigned to process.env before running tests.
Running environment
Supports 'node', 'jsdom', 'happy-dom', 'edge-runtime'
If used unsupported string, will try to load the package vitest-environment-${env}
'node'
Automatically assign environment based on globs. The first match will be used. This has effect only when running tests inside Node.js.
Format: [glob, environment-name]
[]
[
// all tests in tests/dom will run in jsdom
['tests/dom/**', 'jsdom'],
// all tests in tests/ with .edge.test.ts will run in edge-runtime
['**/*.edge.test.ts', 'edge-runtime'],
// ...
]
Environment options.
Exclude globs for test files
['node_modules', 'dist', '.idea', '.git', '.cache']
Show full diff when snapshot fails instead of a patch.
Options for @sinon/fake-timers
Should all test files run in parallel. Doesn't affect tests running in the same file.
Setting this to false will override maxWorkers and minWorkers options to 1.
true
Optional filtersGlob patter of file paths that will trigger the whole suite rerun
Useful if you are testing calling CLI commands
[]
Path to global setup files
Register apis globally
false
Hide logs for skipped tests
false
Default timeout of a hook in milliseconds
10000
Include globs for test files
['**/*.{test,spec}.?(c|m)[jt]s?(x)']
Include globs for in-source test files
[]
Debug tests by opening node:inspector in worker / child process.
Provides similar experience as --inspect Node CLI argument.
Requires poolOptions.threads.singleThread: true OR poolOptions.forks.singleFork: true.
Debug tests by opening node:inspector in worker / child process and wait for debugger to connect.
Provides similar experience as --inspect-brk Node CLI argument.
Requires poolOptions.threads.singleThread: true OR poolOptions.forks.singleFork: true.
Run tests in an isolated environment. This option has no effect on vmThreads pool.
Disabling this option might improve performance if your code doesn't rely on side effects.
true
Show heap usage after each test. Useful for debugging memory leaks.
A number of tests that are allowed to run at the same time marked with test.concurrent.
5
Maximum number of workers to run tests in. poolOptions.{threads,vmThreads}.maxThreads/poolOptions.forks.maxForks has higher priority.
Minimum number of workers to run tests in. poolOptions.{threads,vmThreads}.minThreads/poolOptions.forks.minForks has higher priority.
Will call .mockReset() on all spies before each test
false
Name of the project. Will be used to display in the reporter.
Custom handler for console.log in tests.
Return false to ignore the log.
Custom handler for console.log in tests.
Return false to ignore the log.
Enable stack trace filtering. If absent, all stack trace frames will be shown.
Return false to omit the frame.
Enable stack trace filtering. If absent, all stack trace frames will be shown.
Return false to omit the frame.
Open UI automatically.
true
Write test results to a file when the --reporter=jsonor--reporter=junit` option is also specified.
Also definable individually per reporter by using an object instead.
Pass with no tests
Automatically assign pool based on globs. The first match will be used.
Format: [glob, pool-name]
[]
[
// all tests in "forks" directory will run using "poolOptions.forks" API
['tests/forks/**', 'forks'],
// all other tests will run based on "poolOptions.threads" option, if you didn't specify other globs
// ...
]
Optional poolName of the project or projects to run.
Optional relatedWill call .mockRestore() on all spies before each test
false
Retry the test specific number of times if it fails.
0
Project root
process.cwd()
Optional runnerOptional concurrent?: booleanOptional shuffle?: booleanVite-node server options
Path to setup files
Optional shardSilent mode
false
The number of milliseconds after which a test is considered slow and reported as such in the results.
300
Format options for snapshot testing.
Default timeout to wait for close when Vitest shuts down, in milliseconds
10000
Optional testDefault timeout of a test in milliseconds
5000
Determine the transform method for all modules imported inside a test that matches the glob pattern.
Internal uiEnable Vitest UI
Base url for the UI
'/__vitest__/'
Will restore all env stubs to their original values before each test
false
Will restore all global stubs to their original values before each test
false
Update snapshot
false
Watch mode
true
Glob pattern of file paths to be ignore from triggering watch rerun
Path to a workspace configuration file
Generated using TypeDoc
Specifies an
Object, or anArrayofObject, which defines aliases used to replace values inimportorrequirestatements. Will be merged with the default aliases insideresolve.alias.