-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
[Node v20] assert.deepEqual doesn't detect two different URLs #50836
Comments
This comment was marked as resolved.
This comment was marked as resolved.
The two URLs are different.
It works in v18 and the bug is in v20. |
cc @anonrig |
The difference is not about assert. It's about URL changing the properties of the object. In Node.js 18 the symbol was enumerable and therefore it was compared by assert. But the URL object changed in the meanwhile. |
I believe it is closely related to #46904 which changing the Will it be acceptable to check like node/lib/internal/util/comparisons.js Lines 184 to 204 in f425710
|
The const util = require("node:util");
const url1 = new URL("http://foo1.com/");
const url2 = new URL("http://foo2.com/");
console.log(util.isDeepStrictEqual(url1, url2));
// true |
FYI There's the same problem with import assert from 'node:assert/strict';
const promise1 = Promise.resolve("foo");
const promise2 = Promise.resolve("bar");
assert.deepEqual(promise1, promise2); |
PR-URL: nodejs#50853 Fixes: nodejs#50836 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Fixes #4 . Note that some newer supported Node.js versions have a regression where `deepStrictEquals` fails to compare the URL HREF, but a fix has recently been merged: - nodejs/node#50836 - nodejs/node#50853 (comment) Until the fix has been published in new Node.js releases, we can rely on the GitHub Actions CI workflow testing with Node.js v18 which doesn’t have the regression.
PR-URL: nodejs#50853 Fixes: nodejs#50836 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Version
v20.9.0
Platform
Linux regseblaptop 6.2.0-36-generic #37~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 9 15:34:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
create file
index.js
:node index.js
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
The
index.js
script must raise an error because the two URLs are different.What do you see instead?
No error.
Additional information
npx node@18 index.js
The text was updated successfully, but these errors were encountered: