Skip to main content

no-empty-vitest-coverage-reports-directory

Disallow empty test.coverage.reportsDirectory values in Vitest config.

Rule catalog ID: R032

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when Vitest coverage options are used
  • test.coverage.reportsDirectory

What this rule reportsโ€‹

This rule reports empty or whitespace-only static test.coverage.reportsDirectory values.

Why this rule existsโ€‹

Coverage directories are usually consumed by CI artifacts and local report tooling. An empty value is a fragile misconfiguration and often indicates unfinished setup.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
coverage: {
reportsDirectory: "",
},
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
coverage: {
reportsDirectory: "./coverage",
},
},
});

Behavior and migration notesโ€‹

  • this rule checks static strings only
  • computed values are not evaluated

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 report directories are generated dynamically and blank committed placeholders are intentional.

Package documentationโ€‹

Further readingโ€‹