Skip to content

Commit

Permalink
skip esm
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed May 19, 2023
1 parent 96ebec3 commit 5fc5de0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/babel-core/test/errors-stacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ import { fileURLToPath } from "url";
import path from "path";
import { spawnSync } from "child_process";
import semver from "semver";
import { readFileSync } from "fs";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

let USE_ESM = false;
try {
const type = readFileSync(
new URL("../../../.module-type", import.meta.url),
"utf-8",
).trim();
USE_ESM = type === "module";
} catch {}

const replaceAll = "".replaceAll
? Function.call.bind("".replaceAll)
: (str, find, replace) => str.split(find).join(replace);
Expand Down Expand Up @@ -288,7 +298,7 @@ describe("@babel/core errors", function () {
`);
});

(semver.gte(process.version, "12.0.0") ? it : it.skip)(
(semver.gte(process.version, "12.0.0") && !USE_ESM ? it : it.skip)(
"should not throw in `node --frozen-intrinsics`",
function () {
expect(
Expand Down

0 comments on commit 5fc5de0

Please sign in to comment.