Skip to main content

no-zero-vitest-slow-test-threshold

Disallow test.slowTestThreshold: 0 in Vitest configuration.

Rule catalog ID: R021

Targeted pattern scopeโ€‹

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

What this rule reportsโ€‹

This rule reports explicit test.slowTestThreshold: 0 assignments.

Why this rule existsโ€‹

slowTestThreshold controls when Vitest reports slow tests. Setting it to 0 disables practical slow-test signal and makes it harder to detect performance regressions in the suite.

This repository focuses on configuration quality, so preventing disabled slow-test reporting is a useful Vitest-specific guardrail.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

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

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
slowTestThreshold: 300,
},
});

Behavior and migration notesโ€‹

  • this rule only reports explicit zero-valued thresholds
  • it does not require setting slowTestThreshold when omitted
  • tune the threshold to fit your environment (e.g. 300โ€“1000 ms) rather than disabling the signal entirely

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 removes slow-test reporting from committed Vitest configuration.

Package documentationโ€‹

Further readingโ€‹