Skip to main content

no-vitest-min-workers-greater-than-max-workers

Disallow worker bounds where test.minWorkers is greater than test.maxWorkers.

Rule catalog ID: R042

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when Vitest options are configured
  • test.minWorkers and test.maxWorkers within the same test scope

What this rule reportsโ€‹

This rule reports static bounds where:

  • test.minWorkers > test.maxWorkers

Why this rule existsโ€‹

Worker bounds must be internally consistent. Invalid bounds can produce confusing runtime behavior and hard-to-debug parallelism issues.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

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

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

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

Behavior and migration notesโ€‹

  • this rule checks static literal/template numeric values only
  • it compares values within the same test object scope

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 minWorkers/maxWorkers relationship is intentionally resolved dynamically at runtime and static placeholders are expected to violate bounds.

Package documentationโ€‹

Further readingโ€‹