{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/10258","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/10258/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/10258/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/10258/events","html_url":"https://github.com/nodejs/node/issues/10258","id":195399264,"number":10258,"title":"assert.deepStrictEqual is fooled by strange dates","user":{"login":"akdor1154","id":6732831,"avatar_url":"https://avatars.githubusercontent.com/u/6732831?v=3","gravatar_id":"","url":"https://api.github.com/users/akdor1154","html_url":"https://github.com/akdor1154","followers_url":"https://api.github.com/users/akdor1154/followers","following_url":"https://api.github.com/users/akdor1154/following{/other_user}","gists_url":"https://api.github.com/users/akdor1154/gists{/gist_id}","starred_url":"https://api.github.com/users/akdor1154/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akdor1154/subscriptions","organizations_url":"https://api.github.com/users/akdor1154/orgs","repos_url":"https://api.github.com/users/akdor1154/repos","events_url":"https://api.github.com/users/akdor1154/events{/privacy}","received_events_url":"https://api.github.com/users/akdor1154/received_events","type":"User","site_admin":false},"labels":[{"id":155267445,"url":"https://api.github.com/repos/nodejs/node/labels/assert","name":"assert","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-12-13T23:29:30Z","updated_at":"2016-12-15T01:06:59Z","closed_at":null,"body":"<!--\r\nThank you for reporting an issue.\r\n\r\nThis issue tracker is for bugs and issues found within Node.js core.\r\nIf you require more general support please file an issue on our help\r\nrepo. https://github.com/nodejs/help\r\n\r\n\r\nPlease fill in as much of the template below as you're able.\r\n\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you are able.\r\n-->\r\n\r\n\r\n* Version: v6.9.1\r\n* Platform: OS X\r\n* Subsystem: assert\r\n\r\n<!-- Enter your issue details below this comment. -->\r\n\r\n`assert.deepStrictEqual` (and `strictEqual`) is fooled by the following code:\r\n```js\r\nfunction FakeDate() {};\r\nFakeDate.prototype = Date.prototype;\r\nconst f = new FakeDate();\r\nconst d = new Date();\r\n\r\nf.toString();\r\n//TypeError: Method Date.prototype.toString called on incompatible receiver [object Object]\r\n\r\nd.toString();\r\n//'Wed Dec 14 2016 09:53:28 GMT+1100 (AEDT)'\r\n\r\nassert.deepStrictEqual(d, f);\r\n// does not throw any error\r\n```\r\n\r\nI think it's reasonable to expect that `assert.deepStrictEqual` should consider `d` and `f` as unequal.\r\n\r\nI have not tested on Node master, however there are no relevant changes in `assert.js` between 6.9.1 and master."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/267206572","html_url":"https://github.com/nodejs/node/issues/10258#issuecomment-267206572","issue_url":"https://api.github.com/repos/nodejs/node/issues/10258","id":267206572,"user":{"login":"joyeecheung","id":4299420,"avatar_url":"https://avatars.githubusercontent.com/u/4299420?v=3","gravatar_id":"","url":"https://api.github.com/users/joyeecheung","html_url":"https://github.com/joyeecheung","followers_url":"https://api.github.com/users/joyeecheung/followers","following_url":"https://api.github.com/users/joyeecheung/following{/other_user}","gists_url":"https://api.github.com/users/joyeecheung/gists{/gist_id}","starred_url":"https://api.github.com/users/joyeecheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joyeecheung/subscriptions","organizations_url":"https://api.github.com/users/joyeecheung/orgs","repos_url":"https://api.github.com/users/joyeecheung/repos","events_url":"https://api.github.com/users/joyeecheung/events{/privacy}","received_events_url":"https://api.github.com/users/joyeecheung/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T01:06:59Z","updated_at":"2016-12-15T01:06:59Z","body":"> These look correct to me. deepEqual is not strict (only ==) so Number and Boolean Objects (not to be confused with Number(num) and Boolean(bool), the new makes a big difference!) just coerce to being \"objects\".\r\n\r\n@Fishrock123 I am 50/50 on this, given it's a 50/50 result among the user land modules that I've tested :). I am currently inclined to leave `deepEqual` as-is and perform a more strict type check for `deepStrictEqual`.\r\n\r\nAlso, I think we could stress that `deepEqual` is in fact, a \"loose\"(non-strict) comparison in the docs, in case people miss the docs of `deepStrictEqual`. Some user land modules put the name \"deep equal\" on a more `deepStrictEqual`-ish functionality, so if their user can be surprised when transitioning to use `assert` in the core. Given that `power-assert` is gaining popularity I think there will be more people doing this(I know a few of my colleges are evangelizing it).\r\n\r\nTrying to make a PR now! :)\r\n"}}
{"actor":{"display_login":"joyeecheung"}}