snippetbashTip
vitest — Fast, modern testing framework built for Vite, offering seamless integration, TypeScript support, an
Viewed 0 times
commandvitestmodernframeworkclifastbuilttesting
Problem
How to use the
vitest command: Fast, modern testing framework built for Vite, offering seamless integration, TypeScript support, and a Jest-compatible API for unit, integration, and snapshot testing. More information: <https://vitest.dev/guide/cli.html>.Solution
vitest — Fast, modern testing framework built for Vite, offering seamless integration, TypeScript support, and a Jest-compatible API for unit, integration, and snapshot testing. More information: <https://vitest.dev/guide/cli.html>.Run all available tests:
vitest runRun the test suites from the given files:
vitest run {{path/to/file1 path/to/file2 ...}}Run the test suites from files within the current and subdirectories, whose paths match the given
regex:vitest run {{regex1 regex2 ...}}Run the tests whose names match the given
regex:vitest run {{[-t|--testNamePattern]}} {{regex}}Watch files for changes and automatically re-run related tests:
vitestRun tests with coverage:
vitest run --coverageRun all tests but stops immediately after the first test failure:
vitest run --bail=1Display help:
vitest --helpCode Snippets
Run all available tests
vitest runRun the test suites from the given files
vitest run {{path/to/file1 path/to/file2 ...}}Run the test suites from files within the current and subdirectories, whose paths match the given `regex`
vitest run {{regex1 regex2 ...}}Run the tests whose names match the given `regex`
vitest run {{[-t|--testNamePattern]}} {{regex}}Watch files for changes and automatically re-run related tests
vitestContext
tldr-pages: common/vitest
Revisions (0)
No revisions yet.