vitest/no-conditional-in-test

January 2, 2026 ยท View on GitHub

๐Ÿ“ Disallow conditional tests.

โš ๏ธ This rule warns in the ๐ŸŒ all config.

Rule Details

This rule aims to prevent conditional tests.

Examples of incorrect code for this rule:

test('my test', () => {
  if (true) {
    doTheThing()
  }
})

Examples of correct code for this rule:

test('my test', () => {
  expect(true).toBe(true)
})