Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 730 Bytes

no-incorrect-deep-equal.md

File metadata and controls

31 lines (21 loc) · 730 Bytes

Avoid using deepEqual with primitives

Translations: Français

The deepEqual and notDeepEqual assertions are unnecessary when comparing primitives. Use is or not instead.

This rule is fixable.

Fail

t.deepEqual(expression, 'foo');
t.deepEqual(expression, 1);
t.deepEqual(expression, `foo${bar}`);
t.deepEqual(expression, null);
t.deepEqual(expression, undefined);
t.notDeepEqual(expression, undefined);

Pass

t.is(expression, 'foo');

t.deepEqual(expression, otherExpression);
t.deepEqual(expression, {});
t.deepEqual(expression, []);
t.notDeepEqual(expression, []);