Skip to content

Latest commit

 

History

History
21 lines (13 loc) · 682 Bytes

File metadata and controls

21 lines (13 loc) · 682 Bytes

jest/prefer-strict-equal

Rule Details

Prefer toStrictEqual() over toEqual() on expect(). It is common to expect objects to not only have identical values but also to have identical keys. A stricter equality will catch cases where two objects do not have identical keys.

Examples of incorrect code for this rule:

expect({ a: 'a', b: undefined }).toEqual({ a: 'a' });

Examples of correct code for this rule:

expect({ a: 'a', b: undefined }).toStrictEqual({ a: 'a' });

Original Documentation