vitest
Vitest suites: test lint rules, and passing tests before every push. Level all adds a coverage minimum. It requires javascript. Guide: Tests.
Selected when
Section titled “Selected when”A scope has filenames vitest.config.* or vitest.workspace.*, or a dependency on vitest.
Checks
Section titled “Checks”Runs Vitest with coverage, and fails on a failed test or when lines, branches, functions, or statements fall under their minimums.
Runs at the push stage, once per scope, and loads your code.
A coverage minimum keeps new code from arriving untested.
What to do
Section titled “What to do”Fix each failed test, and add tests for the code that the report marks uncovered. Lower a minimum under coverage only with a reason.
Example
Section titled “Example”Vitest reports ERROR: Coverage for lines (85%) does not meet global threshold (90%). Add tests for the uncovered lines.
Turn it off
Section titled “Turn it off”gspot ignore vitest/tests --paths "<path>" --reason "<why>"To silence one place, write a comment such as:
/* v8 ignore next -- reason: only a full disk reaches this branch */Settings
Section titled “Settings”| Setting | What it sets |
|---|---|
coverage.min_line_percent |
The minimum percentage of source lines covered by tests. |
coverage.min_branch_percent |
The minimum percentage of source branches covered by tests. |
coverage.min_function_percent |
The minimum percentage of source functions covered by tests. |
coverage.min_statement_percent |
The minimum percentage of source statements covered by tests. |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| vitest | 2.0.0 or later, install it yourself |
| @vitest/eslint-plugin | 1.6.27 |
| @vitest/coverage-v8 | Any, install it yourself |