💼 This rule is enabled in the ✅ recommended
config.
The assert.propEqual
assertion is for the strict-equality comparison of own-properties
of two objects. If the expected value is a string or other non-object, the assertion
result can be unexpected.
For string comparisons, assert.strictEqual
should be used. For arrays,
assert.deepEqual
should be used.
The following patterns are considered warnings:
assert.propEqual(actual, 0);
assert.propEqual(actual, "foo");
assert.propEqual(actual, `foo`);
assert.propEqual(actual, /regex/);
The following patterns are not considered warnings:
assert.propEqual(actual, { foo: "bar" });
assert.propEqual(actual, ["array"]);
// Variables are not checked
assert.propEqual(actual, foo);
This rule should be reasonably safe to use in all circumstances.