-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
assertIssues and PRs related to the assert subsystem.Issues and PRs related to the assert subsystem.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.
Description
- Version:
- 14.x (but probably also others)
- Platform:
- all
What steps will reproduce the bug?
const { deepStrictEqual } = require("assert");
const a = {};
const b = {};
a.x = 1;
Object.defineProperties(b, {
x: {
value: 1,
writable: true,
},
y: {
value: 5,
writable: true,
enumerable: true,
configurable: true,
},
});
console.log({ a, b });
deepStrictEqual(a, b); // does not assert
deepStrictEqual(b, a); // does assert
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
I expect deepStrictEqual to be at least commutative. (Whether it should handle non-enumerable properties may be up for discussion)
What do you see instead?
deepStrictEqual(b, a)
does throw an assertion while deepStrictEqual(a, b)
does not.
Additional information
If you point me in the right direction I'm willing to fix it myself.
Metadata
Metadata
Assignees
Labels
assertIssues and PRs related to the assert subsystem.Issues and PRs related to the assert subsystem.confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.