Skip to main content

require-vitest-sequence-seed-when-shuffle

Require test.sequence.seed whenever test.sequence.shuffle is enabled.

Rule catalog ID: R035

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when Vitest test.sequence options are used

What this rule reportsโ€‹

This rule reports test.sequence.shuffle: true when no explicit static test.sequence.seed is configured.

Why this rule existsโ€‹

Shuffled test order can expose order-dependent failures, but reproducing those failures requires a deterministic seed. This rule enforces that reproducibility guardrail.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
sequence: {
shuffle: true,
},
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
sequence: {
shuffle: true,
seed: 42,
},
},
});

Behavior and migration notesโ€‹

  • the rule checks static seed values only
  • it reports once when shuffle is enabled without a seed

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 you intentionally use non-deterministic shuffled execution in committed config and accept reduced reproducibility.

Package documentationโ€‹

Further readingโ€‹