Skip to content

assert: handle NaN properly

As it is, when two NaNs are compared with assert module, they fail.

> process.version
'v3.0.0'
> assert.equal(NaN, NaN)
AssertionError: NaN == NaN
    at repl:1:8
    at REPLServer.defaultEval (repl.js:164:27)

this patch makes sure that NaNs are properly asserted, with the help of Number.isNaN function.

> process.version
'v4.0.0-pre'
> assert.equal(NaN, NaN);
undefined
> assert.strictEqual(NaN, NaN);
undefined
> assert.deepEqual(NaN, NaN);
undefined
> assert.deepStrictEqual(NaN, NaN);
undefined

Merge request reports

Loading