Skip to main content

no-vitest-single-thread-pool-by-default

Disallow single-thread pool defaults in committed Vitest config.

Rule catalog ID: R039

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when Vitest pool options are configured
  • test.poolOptions.*.(threads|maxThreads|maxWorkers) static values set to 1

What this rule reportsโ€‹

This rule reports single-thread pool defaults such as:

  • threads: 1
  • maxThreads: 1
  • maxWorkers: 1

when they are configured under test.poolOptions.

Why this rule existsโ€‹

Single-thread pool defaults reduce test throughput and can hide concurrency issues. In shared configuration, these values are often temporary debugging settings that should not be committed.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
poolOptions: {
threads: {
maxThreads: 1,
},
},
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
poolOptions: {
threads: {
maxThreads: 2,
},
},
},
});

Behavior and migration notesโ€‹

  • this rule checks static numeric/string values only
  • it targets shared config files, not arbitrary source modules

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 project intentionally enforces single-thread pool execution in committed shared config.

Package documentationโ€‹

Further readingโ€‹