Skip to content

deepEqual(new Error(), new Error()) behavior changed in node 8 #213

@dominykas

Description

@dominykas

Ran into this at some point recently as part of asserting with code - it's easy enough to avoid, but could still be useful to clarify which behavior is correct:

✔ ~/devel/projects/tmp 
15:08 $ nvm use 6
Now using node v6.11.2 (npm v5.4.2)
✔ ~/devel/projects/tmp 
15:08 $ node
> require('hoek').deepEqual(new Error(), new Error())
true

vs

✔ ~/devel/projects/tmp 
15:08 $ nvm use 8
Now using node v8.5.0 (npm v5.4.2)
✔ ~/devel/projects/tmp 
15:09 $ node
> require('hoek').deepEqual(new Error(), new Error())
false

It seems that in node 8 property descriptor for error.stack no longer has a get function, but rather has a value - which forces a different path - and the stack is different for the two errors, so possibly the previous behavior was incorrect?

Metadata

Metadata

Assignees

Labels

bugBug or defectnon issueIssue is not a problem or requires changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions