vitest/prefer-each

January 2, 2026 ยท View on GitHub

๐Ÿ“ Enforce using each rather than manual loops.

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

// bad
for (const item of items) {
  describe(item, () => {
    expect(item).toBe('foo')
  })
}

// good
describe.each(items)('item', (item) => {
  expect(item).toBe('foo')
})