Skip to content

Commit e976248

Browse files
[babel 8] Remove -d/-gc babel-node aliases (#15956)
* [babel 8] Remove `-d`/`-gc` babel-node aliases * Skip test
1 parent 714d271 commit e976248

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

packages/babel-node/src/babel-node.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ function getNormalizedV8Flag(arg: string) {
3939
return arg;
4040
}
4141

42-
// These are aliases for node options defined by babel-node.
43-
// TODO(Babel 8): Consider removing these
44-
const aliases = new Map([
45-
["-d", "--debug"],
46-
["-gc", "--expose-gc"],
47-
]);
48-
4942
getV8Flags(async function (err, v8Flags) {
5043
if (!process.env.BABEL_8_BREAKING) {
5144
// The version of v8flags used by Babel 7 uses _, while the one used
@@ -62,11 +55,18 @@ getV8Flags(async function (err, v8Flags) {
6255
const arg = babelArgs[i];
6356
const flag = arg.split("=")[0];
6457

58+
if (!process.env.BABEL_8_BREAKING) {
59+
if (flag === "-d") {
60+
args.unshift("--debug");
61+
continue;
62+
} else if (flag === "-gc") {
63+
args.unshift("--expose-gc");
64+
continue;
65+
}
66+
}
6567
if (flag === "-r" || flag === "--require") {
6668
args.push(flag);
6769
args.push(babelArgs[++i]);
68-
} else if (aliases.has(flag)) {
69-
args.unshift(aliases.get(flag));
7070
} else if (
7171
flag === "debug" || // node debug foo.js
7272
flag === "inspect" ||

packages/babel-node/test/fixtures.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import path from "path";
66
import fs from "fs";
77
import { fileURLToPath } from "url";
88
import { createRequire } from "module";
9+
import { itBabel8, itBabel7 } from "$repo-utils";
910

1011
const require = createRequire(import.meta.url);
1112

@@ -198,7 +199,11 @@ describe("bin/babel-node", function () {
198199
opts.inFiles["package.json"] = `{ "type": "commonjs" }`;
199200
}
200201

201-
// eslint-disable-next-line jest/valid-title
202-
it(testName, buildTest(testName, opts), 20000);
202+
let run = it;
203+
if (typeof opts.BABEL_8_BREAKING === "boolean") {
204+
run = opts.BABEL_8_BREAKING ? itBabel8 : itBabel7;
205+
}
206+
207+
run(testName, buildTest(testName, opts), 20000);
203208
});
204209
});
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"args": ["-gc", "--eval", "console.log(typeof global.gc)"],
3-
"stdout": "function"
3+
"stdout": "function",
4+
"BABEL_8_BREAKING": false
45
}

0 commit comments

Comments
 (0)