Skip to main content

no-empty-vitest-include

Disallow empty test.include arrays in Vitest configuration.

Rule catalog ID: R025

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when a Vitest test block is used
  • root and inline project test.include

What this rule reportsโ€‹

This rule reports explicit test.include: [] assignments.

Why this rule existsโ€‹

An empty include list often means no tests are discovered at runtime. Because this setting controls discovery directly, reporting an empty static array helps catch broken suites before CI runs.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

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

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

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

Behavior and migration notesโ€‹

  • this rule only reports statically empty arrays
  • it does not validate glob quality or coverage completeness

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 setup intentionally keeps test.include empty in committed config and supplies include patterns exclusively through CLI/runtime overrides.

Package documentationโ€‹

Further readingโ€‹