there is nothing wrong with assert.isNaN(void 0) , is this a bug?
Hey @huaguhzheng thanks for the issue
It looks like we use isNaN instead of Number.isNaN - the difference beeing that isNaN ($18.2.3) coerces the value to a number before checking if it is NaN, while Number.isNaN ($20.1.2.4) does not.
We should probably use Number.isNaN - but to do so would be a breaking change. So I welcome a PR to be made, but it should be made against the 4.x.x branch - not master. You'll also need to change the tests which are currently here.
It looks like this is already fixed on the 4.x.x branch (see #498)
Ahhh! Sorry about that, good detective work!
I'll close this. We hope to be releasing 4.0.0 soon enough. For now you can guard the assertion with an additional type check:
var num = void 0;
assert.typeOf(num, 'number');
assert.isNaN(num);
Most helpful comment
Hey @huaguhzheng thanks for the issue
It looks like we use
isNaNinstead ofNumber.isNaN- the difference beeing thatisNaN($18.2.3) coerces the value to a number before checking if it isNaN, whileNumber.isNaN($20.1.2.4) does not.We should probably use
Number.isNaN- but to do so would be a breaking change. So I welcome a PR to be made, but it should be made against the4.x.xbranch - notmaster. You'll also need to change the tests which are currently here.