assert.deepStrictEqual is fooled by strange dates

  • 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.