Skip to main content

no-empty-vitest-bench-include

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

Rule catalog ID: R028

Targeted pattern scopeโ€‹

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

What this rule reportsโ€‹

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

Why this rule existsโ€‹

An empty benchmark include list often disables benchmark discovery entirely. This rule catches that high-impact config mistake early.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

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

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

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

Behavior and migration notesโ€‹

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

ESLint flat config exampleโ€‹

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

export default [vite.configs.strict, vite.configs["vitest-bench"]];

When not to use itโ€‹

Disable this rule only if benchmark include patterns are injected dynamically and empty committed arrays are intentional placeholders.

Package documentationโ€‹

Further readingโ€‹