vitest/no-duplicate-hooks

January 2, 2026 ยท View on GitHub

๐Ÿ“ Disallow duplicate hooks and teardown hooks.

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

Rule Details

This rule aims to prevent duplicate hooks and teardown hooks.

Examples of incorrect code for this rule:

test('foo', () => {
  beforeEach(() => {})
  beforeEach(() => {}) // duplicate beforeEach
})

Examples of correct code for this rule:

test('foo', () => {
  beforeEach(() => {})
})