-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix CI for Node 16.14.x #5404
Fix CI for Node 16.14.x #5404
Conversation
These import assertions weren't actually running on older versions of Node. They failed to parse so failed to run at all. Node 16.14.x added support to parse the import assertion syntax but instead failed with `Invalid module "data:application/json,..." has an unsupported MIME type "application/json"` Node 17.8.x supports the syntax and supports the `application/json` mime as well.
We’ve been using feature detection for this rather than hard-coding Node versions. See Lines 465 to 479 in 3d39d20
Do you mind updating the last line there, about import assertions, such that that resolves the issue? So that we don’t need to put guards in the test file itself. Some of the tests don’t parse at all in certain versions of Node because of syntax, and so it’s important not to load the file at all (rather than loading it and skipping most or all of its contents based on a condition). |
This is the same test referenced in the last I'll poke around and see if I can extend |
92470ce
to
0c617e5
Compare
Now that I think about it more, I think Though if you get it to work within |
0c617e5
to
0511bed
Compare
I dug into this a bit: nodejs/node#41736 (comment) Basically, Node 16.14.0 included support for the import assertions syntax, so that syntax starts parsing as of 16.14.0; but JSON modules still require the So I guess we can land this try/catch for now and just remove it once 16.15.0 is released, in order to unblock your other PRs. I pushed a commit to add more info to the comment. |
Guarding dynamic import tests based on Node version
These import assertions weren't actually running on older versions of
Node. They failed to parse so failed to run at all. Node 16.14.x added
support to parse the import assertion syntax but instead failed with
Invalid module "data:application/json,..." has an unsupported MIME type "application/json"
Node 17.8.x supports the syntax and supports the
application/json
mimeas well.
As a cleanup item also updated caniuse-lite.