Skip to main content

no-vitest-bail-and-retry-conflict

Disallow conflicting test.bail + test.retry combinations in the same Vitest test scope.

Rule catalog ID: R040

Targeted pattern scopeโ€‹

  • vitest.config.*
  • vitest.workspace.*
  • vite.config.* when Vitest options are configured
  • same test object containing enabled bail and enabled retry

What this rule reportsโ€‹

This rule reports when both are enabled in the same scope:

  • test.bail (true or > 0)
  • test.retry (> 0)

Why this rule existsโ€‹

Bail and retry represent opposing failure strategies. Combining both often creates noisy, hard-to-interpret failure behavior.

โŒ Incorrectโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
bail: 1,
retry: 2,
},
});

โœ… Correctโ€‹

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
bail: 0,
retry: 2,
},
});

Behavior and migration notesโ€‹

  • this rule checks static values only
  • it reports once per conflicting test 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 project intentionally combines bail and retry semantics and the behavior is explicitly documented.

Package documentationโ€‹

Further readingโ€‹