-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Bug]: unable to match URL query parameters with nodejs v19.8.1 #14012
Comments
+ nodejs 19.9.0 |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
The test in the OP passes for me using Node 19.7. However, using the JSDOM test environment fails. I'd say this is a bug with JSDOM's // file.js
const whatWgURL = require('whatwg-url');
const nodeUrl = new URL('https://example.org/');
const wgUrl = new whatWgURL.URL('https://example.org/');
logSymbols(nodeUrl, wgUrl);
nodeUrl.searchParams.set('a', 'b');
wgUrl.searchParams.set('a', 'b');
logSymbols(nodeUrl, wgUrl);
logSymbols(
new URL('https://example.org/?a=b'),
new whatWgURL.URL('https://example.org/?a=b'),
);
function logSymbols(first, second) {
// https://github.com/jestjs/jest/blob/bc26cd79e60b7bf29d854293f0f011936fda1a5a/packages/expect-utils/src/jasmineUtils.ts#L211-L223
const firstSymbols = Object.getOwnPropertySymbols(first).filter(
symbol => Object.getOwnPropertyDescriptor(first, symbol).enumerable,
);
const secondSymbols = Object.getOwnPropertySymbols(second).filter(
symbol => Object.getOwnPropertyDescriptor(second, symbol).enumerable,
);
console.log({ firstSymbols, secondSymbols });
} $ node -v
v19.7.0
$ node file.js
{ firstSymbols: [ Symbol(context), Symbol(query) ], secondSymbols: [] }
{
firstSymbols: [ Symbol(context), Symbol(query) ],
secondSymbols: [ Symbol(SameObject caches) ]
}
{ firstSymbols: [ Symbol(context), Symbol(query) ], secondSymbols: [] } $ node -v
v20.1.0
$ node file.js
{ firstSymbols: [], secondSymbols: [] }
{ firstSymbols: [], secondSymbols: [ Symbol(SameObject caches) ] }
{ firstSymbols: [], secondSymbols: [] } You can see the symbols are different in the whatwg If the symbols are not enumerable, that would also fix it. (for Jest's comparison to pass it doesn't need to match between whatwg and Node, but it needs to be internally consistent) |
I'd recommend comparing |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
29.5.0
Steps to reproduce
Expected behavior
it doesn't fail with nodejs 19.7.0
Actual behavior
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: