Open Bug 1074049 Opened 7 years ago Updated 7 years ago

Assert.deepEqual does not work properly with NaN values


(Testing :: General, defect)

Not set


(Not tracked)


(Reporter: jcranmer, Unassigned)



... maybe?

I've been testing a lot of my development code in a separate repository using browser tests that relied on chai for its testing assertions <>. Upon importing to comm-central and using Assert.jsm for the assert.* methods, I've noticed that a test which passes using chai fails. It effectively boils down to:

assert.deepEqual({size: NaN}, {size: NaN}).

It's not clear to me from any documentation what the expected behavior should be, although lots of vague references to "== kind of equality", and it looks like the behavior I'm getting comes from <>.

I'm not sure what's proper interoperable behavior because no one ever appears to give a sufficiently precise definition of these things. There aren't even test-based descriptions of what should happen in the test suites of utility libraries for writing test-based descriptive tests. o_O
I see what you mean! It's indeed unfortunate that this things are undocumented. The link to the chai commit did give me some more insight, though, as I started reading the deep-eql module:

So what we could do is integrate that behavior properly into Assert.jsm... I think that'd be best.
OS: Linux → All
Hardware: x86_64 → All
You need to log in before you can comment on or make changes to this bug.