- CLI:
-r, --root <path> - Config: root
Root path
- CLI:
-c, --config <path>
Path to config file
- CLI:
-u, --update - Config: update
Update snapshot
- CLI:
-w, --watch - Config: watch
Enable watch mode
- CLI:
-t, --testNamePattern <pattern> - Config: testNamePattern
Run tests with full names matching the specified regexp pattern
- CLI:
--dir <path> - Config: dir
Base directory to scan for the test files
- CLI:
--ui
Enable UI
- CLI:
--open - Config: open
Open UI automatically (default: !process.env.CI)
- CLI:
--api.port [port]
Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204
- CLI:
--api.host [host]
Specify which IP addresses the server should listen on. Set this to 0.0.0.0 or true to listen on all addresses, including LAN and public addresses
- CLI:
--api.strictPort
Set to true to exit if port is already in use, instead of automatically trying the next available port
- CLI:
--silent [value] - Config: silent
Silent console output from tests. Use 'passed-only' to see logs from failing tests only.
- CLI:
--hideSkippedTests
Hide logs for skipped tests
- CLI:
--reporter <name> - Config: reporters
Specify reporters (default, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)
- CLI:
--outputFile <filename/-s> - Config: outputFile
Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters (example: --outputFile.tap=./tap.txt)
- CLI:
--coverage.provider <name> - Config: coverage.provider
Select the tool for coverage collection, available values are: "v8", "istanbul" and "custom"
- CLI:
--coverage.enabled - Config: coverage.enabled
Enables coverage collection. Can be overridden using the --coverage CLI option (default: false)
- CLI:
--coverage.include <pattern> - Config: coverage.include
Files included in coverage as glob patterns. May be specified more than once when using multiple patterns. By default only files covered by tests are included.
- CLI:
--coverage.exclude <pattern> - Config: coverage.exclude
Files to be excluded in coverage. May be specified more than once when using multiple extensions.
- CLI:
--coverage.clean - Config: coverage.clean
Clean coverage results before running tests (default: true)
- CLI:
--coverage.cleanOnRerun - Config: coverage.cleanOnRerun
Clean coverage report on watch rerun (default: true)
- CLI:
--coverage.reportsDirectory <path> - Config: coverage.reportsDirectory
Directory to write coverage report to (default: ./coverage)
- CLI:
--coverage.reporter <name> - Config: coverage.reporter
Coverage reporters to use. Visit coverage.reporter for more information (default: ["text", "html", "clover", "json"])
- CLI:
--coverage.reportOnFailure - Config: coverage.reportOnFailure
Generate coverage report even when tests fail (default: false)
- CLI:
--coverage.allowExternal - Config: coverage.allowExternal
Collect coverage of files outside the project root (default: false)
- CLI:
--coverage.skipFull - Config: coverage.skipFull
Do not show files with 100% statement, branch, and function coverage (default: false)
- CLI:
--coverage.thresholds.100 - Config: coverage.thresholds.100
Shortcut to set all coverage thresholds to 100 (default: false)
- CLI:
--coverage.thresholds.perFile - Config: coverage.thresholds.perFile
Check thresholds per file. See --coverage.thresholds.lines, --coverage.thresholds.functions, --coverage.thresholds.branches and --coverage.thresholds.statements for the actual thresholds (default: false)
- CLI:
--coverage.thresholds.autoUpdate <boolean|function> - Config: coverage.thresholds.autoUpdate
Update threshold values: "lines", "functions", "branches" and "statements" to configuration file when current coverage is above the configured thresholds (default: false)
- CLI:
--coverage.thresholds.lines <number>
Threshold for lines. Visit istanbuljs for more information. This option is not available for custom providers
- CLI:
--coverage.thresholds.functions <number>
Threshold for functions. Visit istanbuljs for more information. This option is not available for custom providers
- CLI:
--coverage.thresholds.branches <number>
Threshold for branches. Visit istanbuljs for more information. This option is not available for custom providers
- CLI:
--coverage.thresholds.statements <number>
Threshold for statements. Visit istanbuljs for more information. This option is not available for custom providers
- CLI:
--coverage.ignoreClassMethods <name> - Config: coverage.ignoreClassMethods
Array of class method names to ignore for coverage. Visit istanbuljs for more information. This option is only available for the istanbul providers (default: [])
- CLI:
--coverage.processingConcurrency <number> - Config: coverage.processingConcurrency
Concurrency limit used when processing the coverage results. (default min between 20 and the number of CPUs)
- CLI:
--coverage.customProviderModule <path> - Config: coverage.customProviderModule
Specifies the module name or path for the custom coverage provider module. Visit Custom Coverage Provider for more information. This option is only available for custom providers
- CLI:
--coverage.watermarks.statements <watermarks>
High and low watermarks for statements in the format of <high>,<low>
- CLI:
--coverage.watermarks.lines <watermarks>
High and low watermarks for lines in the format of <high>,<low>
- CLI:
--coverage.watermarks.branches <watermarks>
High and low watermarks for branches in the format of <high>,<low>
- CLI:
--coverage.watermarks.functions <watermarks>
High and low watermarks for functions in the format of <high>,<low>
- CLI:
--mode <name> - Config: mode
Override Vite mode (default: test or benchmark)
- CLI:
--isolate - Config: isolate
Run every test file in isolation. To disable isolation, use --no-isolate (default: true)
- CLI:
--globals - Config: globals
Inject apis globally
- CLI:
--dom
Mock browser API with happy-dom
- CLI:
--browser.enabled - Config: browser.enabled
Run tests in the browser. Equivalent to --browser.enabled (default: false)
- CLI:
--browser.name <name>
Run all tests in a specific browser. Some browsers are only available for specific providers (see --browser.provider).
- CLI:
--browser.headless - Config: browser.headless
Run the browser in headless mode (i.e. without opening the GUI (Graphical User Interface)). If you are running Vitest in CI, it will be enabled by default (default: process.env.CI)
- CLI:
--browser.api.port [port] - Config: browser.api.port
Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 63315
- CLI:
--browser.api.host [host] - Config: browser.api.host
Specify which IP addresses the server should listen on. Set this to 0.0.0.0 or true to listen on all addresses, including LAN and public addresses
- CLI:
--browser.api.strictPort - Config: browser.api.strictPort
Set to true to exit if port is already in use, instead of automatically trying the next available port
- CLI:
--browser.isolate - Config: browser.isolate
Run every browser test file in isolation. To disable isolation, use --browser.isolate=false (default: true)
- CLI:
--browser.ui - Config: browser.ui
Show Vitest UI when running tests (default: !process.env.CI)
- CLI:
--browser.detailsPanelPosition <position> - Config: browser.detailsPanelPosition
Default position for the details panel in browser mode. Either right (horizontal split) or bottom (vertical split) (default: right)
- CLI:
--browser.fileParallelism
Should browser test files run in parallel. Use --browser.fileParallelism=false to disable (default: true)
- CLI:
--browser.connectTimeout <timeout> - Config: browser.connectTimeout
If connection to the browser takes longer, the test suite will fail (default: 60_000)
- CLI:
--browser.trackUnhandledErrors - Config: browser.trackUnhandledErrors
Control if Vitest catches uncaught exceptions so they can be reported (default: true)
- CLI:
--browser.trace <mode> - Config: browser.trace
Enable trace view mode. Supported: "on", "off", "on-first-retry", "on-all-retries", "retain-on-failure".
- CLI:
--pool <pool> - Config: pool
Specify pool, if not running in the browser (default: forks)
- CLI:
--execArgv <option> - Config: execArgv
Pass additional arguments to node process when spawning worker_threads or child_process.
- CLI:
--vmMemoryLimit <limit> - Config: vmMemoryLimit
Memory limit for VM pools. If you see memory leaks, try to tinker this value.
- CLI:
--fileParallelism - Config: fileParallelism
Should all test files run in parallel. Use --no-file-parallelism to disable (default: true)
- CLI:
--maxWorkers <workers> - Config: maxWorkers
Maximum number or percentage of workers to run tests in
- CLI:
--environment <name> - Config: environment
Specify runner environment, if not running in the browser (default: node)
- CLI:
--passWithNoTests - Config: passWithNoTests
Pass when no tests are found
- CLI:
--logHeapUsage - Config: logHeapUsage
Show the size of heap for each test when running in node
- CLI:
--allowOnly - Config: allowOnly
Allow tests and suites that are marked as only (default: !process.env.CI)
- CLI:
--dangerouslyIgnoreUnhandledErrors - Config: dangerouslyIgnoreUnhandledErrors
Ignore any unhandled errors that occur
- CLI:
--sequence.shuffle.files - Config: sequence.shuffle.files
Run files in a random order. Long running tests will not start earlier if you enable this option. (default: false)
- CLI:
--sequence.shuffle.tests - Config: sequence.shuffle.tests
Run tests in a random order (default: false)
- CLI:
--sequence.concurrent - Config: sequence.concurrent
Make tests run in parallel (default: false)
- CLI:
--sequence.seed <seed> - Config: sequence.seed
Set the randomization seed. This option will have no effect if --sequence.shuffle is falsy. Visit "Random Seed" page for more information
- CLI:
--sequence.hooks <order> - Config: sequence.hooks
Changes the order in which hooks are executed. Accepted values are: "stack", "list" and "parallel". Visit sequence.hooks for more information (default: "parallel")
- CLI:
--sequence.setupFiles <order> - Config: sequence.setupFiles
Changes the order in which setup files are executed. Accepted values are: "list" and "parallel". If set to "list", will run setup files in the order they are defined. If set to "parallel", will run setup files in parallel (default: "parallel")
- CLI:
--inspect [[host:]port]
Enable Node.js inspector (default: 127.0.0.1:9229)
- CLI:
--inspectBrk [[host:]port]
Enable Node.js inspector and break before the test starts
- CLI:
--testTimeout <timeout> - Config: testTimeout
Default timeout of a test in milliseconds (default: 5000). Use 0 to disable timeout completely.
- CLI:
--hookTimeout <timeout> - Config: hookTimeout
Default hook timeout in milliseconds (default: 10000). Use 0 to disable timeout completely.
- CLI:
--bail <number> - Config: bail
Stop test execution when given number of tests have failed (default: 0)
- CLI:
--retry.count <times> - Config: retry.count
Number of times to retry a test if it fails (default: 0)
- CLI:
--retry.delay <ms> - Config: retry.delay
Delay in milliseconds between retry attempts (default: 0)
- CLI:
--retry.condition <pattern> - Config: retry.condition
Regex pattern to match error messages that should trigger a retry. Only errors matching this pattern will cause a retry (default: retry on all errors)
- CLI:
--diff.aAnnotation <annotation> - Config: diff.aAnnotation
Annotation for expected lines (default: Expected)
- CLI:
--diff.aIndicator <indicator> - Config: diff.aIndicator
Indicator for expected lines (default: -)
- CLI:
--diff.bAnnotation <annotation> - Config: diff.bAnnotation
Annotation for received lines (default: Received)
- CLI:
--diff.bIndicator <indicator> - Config: diff.bIndicator
Indicator for received lines (default: +)
- CLI:
--diff.commonIndicator <indicator> - Config: diff.commonIndicator
Indicator for common lines (default: )
- CLI:
--diff.contextLines <lines> - Config: diff.contextLines
Number of lines of context to show around each change (default: 5)
- CLI:
--diff.emptyFirstOrLastLinePlaceholder <placeholder> - Config: diff.emptyFirstOrLastLinePlaceholder
Placeholder for an empty first or last line (default: "")
- CLI:
--diff.expand - Config: diff.expand
Expand all common lines (default: true)
- CLI:
--diff.includeChangeCounts - Config: diff.includeChangeCounts
Include comparison counts in diff output (default: false)
- CLI:
--diff.omitAnnotationLines - Config: diff.omitAnnotationLines
Omit annotation lines from the output (default: false)
- CLI:
--diff.printBasicPrototype - Config: diff.printBasicPrototype
Print basic prototype Object and Array (default: true)
- CLI:
--diff.maxDepth <maxDepth> - Config: diff.maxDepth
Limit the depth to recurse when printing nested objects (default: 20)
- CLI:
--diff.truncateThreshold <threshold> - Config: diff.truncateThreshold
Number of lines to show before and after each change (default: 0)
- CLI:
--diff.truncateAnnotation <annotation> - Config: diff.truncateAnnotation
Annotation for truncated lines (default: ... Diff result is truncated)
- CLI:
--exclude <glob> - Config: exclude
Additional file globs to be excluded from test
- CLI:
--expandSnapshotDiff - Config: expandSnapshotDiff
Show full diff when snapshot fails
- CLI:
--disableConsoleIntercept - Config: disableConsoleIntercept
Disable automatic interception of console logging (default: false)
- CLI:
--typecheck.enabled - Config: typecheck.enabled
Enable typechecking alongside tests (default: false)
- CLI:
--typecheck.only - Config: typecheck.only
Run only typecheck tests. This automatically enables typecheck (default: false)
- CLI:
--typecheck.checker <name> - Config: typecheck.checker
Specify the typechecker to use. Available values are: "tsc" and "vue-tsc" and a path to an executable (default: "tsc")
- CLI:
--typecheck.allowJs - Config: typecheck.allowJs
Allow JavaScript files to be typechecked. By default takes the value from tsconfig.json
- CLI:
--typecheck.ignoreSourceErrors - Config: typecheck.ignoreSourceErrors
Ignore type errors from source files
- CLI:
--typecheck.tsconfig <path> - Config: typecheck.tsconfig
Path to a custom tsconfig file
- CLI:
--typecheck.spawnTimeout <time> - Config: typecheck.spawnTimeout
Minimum time in milliseconds it takes to spawn the typechecker
- CLI:
--project <name>
The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2. You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern.
- CLI:
--slowTestThreshold <threshold> - Config: slowTestThreshold
Threshold in milliseconds for a test or suite to be considered slow (default: 300)
- CLI:
--teardownTimeout <timeout> - Config: teardownTimeout
Default timeout of a teardown function in milliseconds (default: 10000)
- CLI:
--maxConcurrency <number> - Config: maxConcurrency
Maximum number of concurrent tests in a suite (default: 5)
- CLI:
--expect.requireAssertions - Config: expect.requireAssertions
Require that all tests have at least one assertion
- CLI:
--expect.poll.interval <interval> - Config: expect.poll.interval
Poll interval in milliseconds for expect.poll() assertions (default: 50)
- CLI:
--expect.poll.timeout <timeout> - Config: expect.poll.timeout
Poll timeout in milliseconds for expect.poll() assertions (default: 1000)
- CLI:
--printConsoleTrace - Config: printConsoleTrace
Always print console stack traces
- CLI:
--includeTaskLocation - Config: includeTaskLocation
Collect test and suite locations in the location property
- CLI:
--attachmentsDir <dir> - Config: attachmentsDir
The directory where attachments from context.annotate are stored in (default: .vitest-attachments)
- CLI:
--run
Disable watch mode
- CLI:
--no-color
Removes colors from the console output
- CLI:
--clearScreen
Clear terminal screen when re-running tests during watch mode (default: true)
- CLI:
--configLoader <loader>
Use bundle to bundle the config with esbuild or runner (experimental) to process it on the fly. This is only available in vite version 6.1.0 and above. (default: bundle)
- CLI:
--standalone
Start Vitest without running tests. Tests will be running only on change. This option is ignored when CLI file filters are passed. (default: false)
- CLI:
--listTags [type]
List all available tags instead of running tests. --list-tags=json will output tags in JSON format, unless there are no tags.
- CLI:
--clearCache
Delete all Vitest caches, including experimental.fsModuleCache, without running any tests. This will reduce the performance in the subsequent test run.
- CLI:
--tagsFilter <expression>
Run only tests with the specified tags. You can use logical operators && (and), || (or) and ! (not) to create complex expressions, see Test Tags for more information.
- CLI:
--strictTags - Config: strictTags
Should Vitest throw an error if test has a tag that is not defined in the config. (default: true)
- CLI:
--experimental.fsModuleCache - Config: experimental.fsModuleCache
Enable caching of modules on the file system between reruns.
- CLI:
--experimental.importDurations.print - Config: experimental.importDurations.print
Print import breakdown to CLI terminal after tests finish (default: false).
- CLI:
--experimental.importDurations.limit <number> - Config: experimental.importDurations.limit
Maximum number of imports to collect and display (default: 0, or 10 if print or UI is enabled).
- CLI:
--experimental.viteModuleRunner - Config: experimental.viteModuleRunner
Control whether Vitest uses Vite's module runner to run the code or fallback to the native import. (default: true)
- CLI:
--experimental.nodeLoader - Config: experimental.nodeLoader
Controls whether Vitest will use Node.js Loader API to process in-source or mocked files. This has no effect if viteModuleRunner is enabled. Disabling this can increase performance. (default: true)