Skip to main content

no-vitest-max-workers-zero

Disallow invalid test.maxWorkers values (0 or empty strings).

Rule catalog ID: R041

Targeted pattern scopeโ€‹

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

What this rule reportsโ€‹

This rule reports test.maxWorkers values that are:

  • 0
  • empty strings ("", whitespace-only template/literal strings)

Why this rule existsโ€‹

Invalid worker values can break parallel scheduling and create ambiguous runtime behavior. This is a high-signal static config mistake that is cheap to catch early.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
maxWorkers: 0,
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
maxWorkers: 2,
},
});

Behavior and migration notesโ€‹

  • this rule checks static literal/template values only
  • valid percentage-style strings (for example "50%") are not reported

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 tooling intentionally injects maxWorkers dynamically and committed placeholders use empty or zero values.

Package documentationโ€‹

Further readingโ€‹