-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Closed
Labels
assertIssues and PRs related to the assert subsystem.Issues and PRs related to the assert subsystem.
Description
- Version: v6.9.1
- Platform: OS X
- Subsystem: assert
assert.deepStrictEqual
(and strictEqual
) is fooled by the following code:
function FakeDate() {};
FakeDate.prototype = Date.prototype;
const f = new FakeDate();
const d = new Date();
f.toString();
//TypeError: Method Date.prototype.toString called on incompatible receiver [object Object]
d.toString();
//'Wed Dec 14 2016 09:53:28 GMT+1100 (AEDT)'
assert.deepStrictEqual(d, f);
// does not throw any error
I think it's reasonable to expect that assert.deepStrictEqual
should consider d
and f
as unequal.
I have not tested on Node master, however there are no relevant changes in assert.js
between 6.9.1 and master.
Metadata
Metadata
Assignees
Labels
assertIssues and PRs related to the assert subsystem.Issues and PRs related to the assert subsystem.