Skip to content
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 with Node v23.1.0 #16932

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
liuxingbaoyu committed Oct 25, 2024
commit 4c87422d7084fba9aba48c57095d6d64e96a41ea
10 changes: 8 additions & 2 deletions packages/babel-core/test/helpers/esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ async function spawn(runner, filename, cwd = process.cwd()) {
cwd,
env: {
...process.env,
NODE_OPTIONS: "--disable-warning=ExperimentalWarning",
NODE_OPTIONS:
parseInt(process.versions.node) >= 22
liuxingbaoyu marked this conversation as resolved.
Show resolved Hide resolved
? "--disable-warning=ExperimentalWarning"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does node 23.1 updated the error message? We already removed the experimental warning from stderr.

Plus if we provide other NODE_OPTIONS, this will replaced the provided options and with --disable-warning only.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, so node.js 23.1 updated the experimental warning: now they will print which file imports which module:

ExperimentalWarning: CommonJS module /home/runner/work/babel/babel/packages/babel-core/lib/config/files/module-types.js is loading ES Module /home/runner/work/babel/babel/packages/babel-core/test/fixtures/async/preset-mjs-native/preset.mjs using require().
    Support for loading ES Module in require() is an experimental feature and might change at any time
    (Use `node --trace-warnings ...` to show where the warning was created)

Could have updated the experimental warning regex so we will not accidentally miss unwanted experimental warnings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you open another PR? 🙏

: "",
},
},
);

if (stderr.trim()) {
const EXPERIMENTAL_WARNING =
/\(node:\d+\) ExperimentalWarning: (The ESM module loader is experimental\.|Support for loading ES Module in require\(\) is an experimental feature and might change at any time\n\(Use `node --trace-warnings ...` to show where the warning was created\))/;

if (stderr.replace(EXPERIMENTAL_WARNING, "").trim()) {
throw new Error(
`error is thrown in babel-${runner}.mjs: stdout\n` +
stdout +
Expand Down
Loading