Skip to content

test-runners/auto

Runs the tests with whichever runner the project configures: vitest or jest.

Interface Description
TestCoverageOptions Options for running tests with coverage.
TestOptions Options for running tests.
Function Description
detectTestRunner Chooses the test runner from the configuration files at the project root. The order is a vitest configuration, then a jest one (a file, or a jest key in package.json). A project with neither gets vitest, the runner every package on this toolchain used before jest was supported.
test Runs the test suite with the project’s runner.
testCoverage Runs the test suite with coverage, with the project’s runner.
testWatch Runs the test suite in watch mode, with the project’s runner.
Type Description
TestRunner A test runner the toolkit runs.
TestWatchOptions Options for running tests in watch mode.
Variable Description
VITEST_CONFIG_FILE_NAMES Every file vitest reads its configuration from. vite.config.* is deliberately not among them: a project that bundles with vite and tests with jest has one.