new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Vitest · Config reference · all subjects

config/coverage

15 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

coverage reporter separate option

The coverage feature uses a different coverage.reporter option instead of the reporters option.

coverage.reporter configuration formats

The coverage.reporter option supports three different types of configurations: a single reporter as a string like 'html', multiple reporters without options as an array like ['html', 'json'], and reporters with options as an array of tuples like [['lcov', { 'projectRoot': './src' }], ['json', { 'file': 'coverage.json' }], ['text']]. Custom reporters can be specified using NPM package names or absolute paths.

coverage.thresholds threshold interpretation

For coverage.thresholds, a positive number is interpreted as the minimum percentage of coverage required. A negative number is treated as the maximum number of uncovered items allowed. For example, setting lines threshold to 90 means 90% of lines must be covered, while setting it to -10 means no more than 10 lines may be uncovered.

coverage.include pattern matching behavior

Patterns in coverage.include are matched against each file's path relative to the project root. A pattern with no glob wildcard is treated as a directory and matches everything inside it, so 'include: ["src"]' is equivalent to 'include: ["src/**"]'.

coverage.thresholds.perFile inheritance

When perFile is set on an individual glob-pattern threshold, glob patterns do not inherit the top-level perFile setting; it must be set on each glob explicitly.

coverage.thresholds perFile shorthand

The perFile option accepts { 100: true } as a shortcut inside the object for setting all four metrics (lines, functions, branches, statements) to 100.

coverage.thresholds.autoUpdate function signature

The coverage.thresholds.autoUpdate option can accept a function that receives the new threshold as the first argument and the previous threshold as the second argument. The function should return the formatted threshold value.

coverage.thresholds glob-pattern perFile behavior

Each glob pattern in coverage.thresholds can set its own perFile (boolean | object), checked exactly like the top-level perFile but scoped to the matched files. Glob patterns do not inherit the top-level perFile — set it per glob.

coverage.clean directory warning

Vitest will delete the coverage.reportsDirectory before running tests if coverage.clean is enabled, which is the default value.

AI coding agent coverage reporting

When Vitest detects it is running inside an AI coding agent, it automatically adds the 'text-summary' reporter and sets skipFull: true on the 'text' reporter to reduce output and minimize token usage.

coverage CLI with dot notation warning

If using coverage options with dot notation on the CLI, do not forget to specify --coverage.enabled and do not provide a single --coverage option in that case.

coverage glob pattern threshold scope

Vitest counts all files, including those covered by glob-patterns, into the global coverage thresholds. This is different from Jest behavior where glob patterns might have separate scoping.

coverage.htmlDir auto-configuration

The coverage.htmlDir option is automatically configured when using builtin coverage reporters that produce HTML output (html, html-spa, and lcov). Use this option to override with a custom coverage reporting location when using custom coverage reporters.

coverage.excludeAfterRemap use case

The coverage.excludeAfterRemap option applies exclusions again after coverage has been remapped to original sources. This is useful when source files are transpiled and may contain source maps of non-source files, to prevent files matching coverage.exclude patterns from appearing in the report.

coverage.autoAttachSubprocess performance overhead

The coverage.autoAttachSubprocess option has performance overhead because it uses NODE_V8_COVERAGE internally, which triggers Node to write many unnecessary files on the file system.

Give your agent this brain