Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 340 Bytes

prefer-each.md

File metadata and controls

19 lines (15 loc) · 340 Bytes

Prefer each rather than manual loops (vitest/prefer-each)

⚠️ 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')
})