Skip to main content

no-vitest-timeout-triplet-mismatch

Disallow inconsistent Vitest timeout triplet ordering.

Rule catalog ID: R069

Targeted pattern scopeโ€‹

  • test.testTimeout
  • test.hookTimeout
  • test.teardownTimeout

What this rule reportsโ€‹

This rule reports when all three timeout values are static numbers and teardownTimeout is lower than hookTimeout.

Why this rule existsโ€‹

If teardown has less time than hooks, shutdown and cleanup can fail under load and produce misleading flakes.

โŒ Incorrectโ€‹

export default {
test: {
testTimeout: 20_000,
hookTimeout: 10_000,
teardownTimeout: 5_000,
},
};

โœ… Correctโ€‹

export default {
test: {
testTimeout: 20_000,
hookTimeout: 10_000,
teardownTimeout: 10_000,
},
};

Behavior and migration notesโ€‹

  • Only checks static numeric literals.
  • Only reports when all three timeout keys are present.

ESLint flat config exampleโ€‹

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

export default [vite.configs.vitest];

When not to use itโ€‹

Disable if your workflow intentionally sets teardown lower than hook timeout.

Package documentationโ€‹

Further readingโ€‹