vitest/max-expects
March 1, 2026 ยท View on GitHub
๐ Enforce a maximum number of expect per test.
โ ๏ธ This rule warns in the ๐ all config.
Rule Details
Examples of incorrect code for this rule with max: 1:
test('foo', () => {
expect(1).toBe(1)
expect(2).toBe(2)
})
Examples of correct code for this rule:
test('foo', () => {
expect(1).toBe(1)
})
Options
| Name | Description | Type |
|---|---|---|
max | Maximum number of expect calls allowed in a test. | Number |
Default:
5
Maximum number of expect per test.
{
max: number
}