Should expect(NaN).toBe(NaN) return true? I guess so, but as you know, NaN is the only value where x !== x, so maybe it's correct to return false here.
It should definitely return true.
Added tags as "Good First Issue"; I think it's a nice task to get familiarized with the expect code. Also, people can workaround now by using expect(Number.isNaN(..)).
@mjesun alternatively people can use jest-extended and have a specific named matcher for this: https://github.com/jest-community/jest-extended#tobenan 馃槃
I'm super curious on how many issues will we get in a year from now saying that this is a bug, because ECMAScript says otherwise XD
Is it easy for someone to change all of the docs for toBe to include the caveat that NaN !== NaN but it's handled?
IMO we should change the helper text from (using ===) to (using Object.is), and then we can expect NaN to be NaN while not lying. That said, as @thymikee said, we're probably going to get a lot of bugs based on that; people won't notice the difference.
Most helpful comment
I'm super curious on how many issues will we get in a year from now saying that this is a bug, because ECMAScript says otherwise XD