-
-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing and inconsistent comparison of NaN #1653
Comments
And for the sake of comparison, a similar example, this time using the Node.js assert module: import assert from "node:assert/strict";
import { test } from "node:test";
test("pass", () => {
assert.strictEqual(NaN, NaN);
assert.deepStrictEqual([NaN], [NaN]);
assert.deepStrictEqual({ a: NaN }, { a: NaN });
}); The test above successfully passes. |
Makes sense to me We should do the same as node I suspect @koddsson thoughts? |
Node was special casing their implementation to specifically handle I think our I'm not 100% sure on the With all this being said this has been working like this for a while so I think this feedback is good for how we change the API for Chai@v6 as it seems like most of these changes warrant a breaking change. |
Consider the following example:
The comparison algorithm behaves differently depending on whether NaN values are compared directly or as deep property/member values. This inconsistency creates confusion and diminishes the developer experience.
We suggest to change the behavior of
expect(...).to.equal(...)
andassert.strictEqual(..., ...)
to match their deep counterparts.The text was updated successfully, but these errors were encountered: