Skip to main content

no-vitest-coverage-reporter-text-only

Disallow test.coverage.reporter configurations that only emit text output.

Rule catalog ID: R051

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when Vitest coverage options are configured
  • test.coverage.reporter

What this rule reportsโ€‹

This rule reports reporter configurations that resolve to text-only output, such as:

  • reporter: "text"
  • reporter: ["text"]

Why this rule existsโ€‹

Text-only coverage is useful for quick local feedback but weak for CI/tooling integration. Shared config usually benefits from at least one structured reporter (json, lcov, html, etc.).

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
coverage: {
reporter: ["text"],
},
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
coverage: {
reporter: ["text", "json", "html"],
},
},
});

Behavior and migration notesโ€‹

  • this rule checks static reporter values only
  • it does not report mixed reporter lists that include non-text outputs

ESLint flat config exampleโ€‹

import vite from "@typpi/eslint-plugin-vite";

export default [vite.configs.strict, vite.configs.vitest];

When not to use itโ€‹

Disable this rule only if your shared workflow intentionally relies on text-only coverage output.

Package documentationโ€‹

Further readingโ€‹