Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
test: update ESM loader hooks to allow ambiguous format#52990
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
avivkeller commented May 14, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
GeoffreyBooth left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But is there a purpose behind Node’s internal resolve hook sometimes returning format: null as opposed to the key being missing? If not, maybe our internal hooks should always either set format if it has a truthy value, or don’t define it at all (or set format: undefined) and leave null out of it.
GeoffreyBooth commented May 14, 2024
@nodejs/loaders |
avivkeller commented May 14, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I don't think there is a purpose of setting it to That being said, in this case, the |
GeoffreyBooth commented May 14, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Unless there’s a good reason we need
I’m not sure that this is a good reason. If this is data that we want to preserve, it could be its own property on |
JakobJingleheimer commented May 14, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
IIR, the historical reason (advocated by Antoine) was that Splitting hairs: |
GeoffreyBooth commented May 14, 2024
In this case, the different is very material—some tests fail with |
avivkeller commented May 14, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Just for sake of discussion, what value would be put in place for an unknown format module? (But maybe this is a discussion for another time) |
GeoffreyBooth commented May 15, 2024
Without custom hooks registered, Node throws on unknown formats. |
aduh95 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the test should happen in the same commit that changes the code
aduh95 commented May 15, 2024
You can use this PR to land the variable renaming if you want |
avivkeller commented May 15, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Unlike the other test changes for WDYT @GeoffreyBooth |
GeoffreyBooth commented May 15, 2024
@redyetidev I think reopen #52988 and have it undo the part of #50314 that returned |
avivkeller commented May 15, 2024
Sure, it'll take some work because it seems that certain infrastructure rely on that behavior, but I'll work on it |
Pull request #50314 added support for a
nullformat value in addition to the existingcommonjsormodule. However, the test for ESM hooks relied on the default value ofcommonjs, causing it to fail when run with the--experimental-detect-moduleflag. This PR enables the test to detectnullformats, ensuring it runs successfully with experimental detection enabled.Sidenote: While @GeoffreyBooth and I were debugging this behavior, the single-character function arguments made it very difficult to understand, so this PR also expands them into the full names.