Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 677 Bytes

File metadata and controls

25 lines (16 loc) · 677 Bytes

vitest/prefer-to-contain

📝 Enforce using toContain().

⚠️ This rule warns in the 🌐 all config.

🔧 This rule is automatically fixable by the --fix CLI option.

This rule triggers a warning if toBe(), toEqual() or toStrickEqual() is used to assert object inclusion in an array.

The following patterns are considered warnings:

expect(a.includes(b)).toBe(true)
expect(a.includes(b)).toEqual(true)
expect(a.includes(b)).toStrictEqual(true)

The following patterns are not considered warnings:

expect(a).toContain(b)