Skip to main content

no-empty-vitest-coverage-include

Disallow empty test.coverage.include arrays in Vitest config.

Rule catalog ID: R030

Targeted pattern scopeโ€‹

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

What this rule reportsโ€‹

This rule reports test.coverage.include: [].

Why this rule existsโ€‹

An empty coverage include list usually means intended targeting is effectively disabled. Catching this helps keep coverage settings intentional and useful.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
coverage: {
include: [],
},
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
coverage: {
include: ["src/**/*.ts"],
},
},
});

Behavior and migration notesโ€‹

  • this rule checks static empty arrays only
  • it does not validate include glob quality

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 coverage include patterns are generated dynamically and empty committed arrays are intentional placeholders.

Package documentationโ€‹

Further readingโ€‹