Skip to content

Commit

Permalink
fix: CI exception (babel#14892)
Browse files Browse the repository at this point in the history
Co-authored-by: Huáng Jùnliàng <[email protected]>
Co-authored-by: Nicolò Ribaudo <[email protected]>
  • Loading branch information
3 people authored Aug 31, 2022
1 parent e090ba4 commit 9425eed
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
4 changes: 3 additions & 1 deletion Gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ async function buildBabel(useWorker, ignore = []) {
// @example ./packages/babel-parser/src/index.js
const dest = "./" + mapSrcToLib(file.slice(2));
promises.push(
worker.transform(file, dest, { sourceMaps: enableSourceMap })
worker.transform(file, dest, {
sourceMaps: enableSourceMap && !file.endsWith(".d.ts"),
})
);
}
return Promise.allSettled(promises)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test-ci: build-standalone-ci

test-ci-coverage:
BABEL_ENV=test BABEL_COVERAGE=true $(MAKE) bootstrap
BABEL_ENV=test BABEL_COVERAGE=true $(YARN) jest --maxWorkers=100% --ci
BABEL_ENV=test BABEL_COVERAGE=true $(YARN) jest --maxWorkers=100% --ci --coverage

bootstrap-flow:
rm -rf build/flow
Expand Down
2 changes: 1 addition & 1 deletion Makefile.js

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions Makefile.source.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ function env(fun, env) {
*/

target["clean-all"] = function () {
["node_modules", "package-lock.json", ".changelog"].forEach(path => {
shell.rm("-rf", path);
});
shell.rm("-rf", ["node_modules", "package-lock.json", ".changelog"]);

SOURCES.forEach(source => {
shell.rm("-rf", `${source}/*/test/tmp`);
Expand All @@ -104,14 +102,12 @@ target["clean-all"] = function () {
target["clean"] = function () {
target["test-clean"]();

[
shell.rm("-rf", [
".npmrc",
"coverage",
"packages/*/npm-debug*",
"node_modules/.cache",
].forEach(path => {
shell.rm("-rf", path);
});
]);
};

target["test-clean"] = function () {
Expand All @@ -122,23 +118,22 @@ target["test-clean"] = function () {
};

target["clean-lib"] = function () {
SOURCES.forEach(source => {
shell.rm("-rf", `${source}/*/lib`);
});
shell.rm(
"-rf",
SOURCES.map(source => `${source}/*/lib`)
);
};

target["clean-runtime-helpers"] = function () {
[
shell.rm("-rf", [
"packages/babel-runtime/helpers/**/*.js",
"packages/babel-runtime-corejs2/helpers/**/*.js",
"packages/babel-runtime-corejs3/helpers/**/*.js",
"packages/babel-runtime/helpers/**/*.mjs",
"packages/babel-runtime-corejs2/helpers/**/*.mjs",
"packages/babel-runtime-corejs3/helpers/**/*.mjs",
"packages/babel-runtime-corejs2/core-js",
].forEach(path => {
shell.rm("-rf", path);
});
]);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion babel-worker.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports.transform = async function transform(src, dest, opts = {}) {
const content = readFileSync(src, { encoding: "utf8" });
const { code, map } = await transformAsync(content, {
filename: src,
sourceFileName: `../src/${path.basename(src)}`,
sourceFileName: path.relative(path.dirname(dest), src),
caller: {
// We have wrapped packages/babel-core/src/config/files/configuration.js with feature detection
supportsDynamicImport: true,
Expand Down
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const semver = require("semver");
const shell = require("shelljs");

const nodeVersion = process.versions.node;
const supportsESMAndJestLightRunner = semver.satisfies(
nodeVersion,
Expand All @@ -8,6 +10,11 @@ const supportsESMAndJestLightRunner = semver.satisfies(
);
const isPublishBundle = process.env.IS_PUBLISH;

if (!supportsESMAndJestLightRunner) {
//Avoid source maps from breaking stack tests.
shell.rm("-rf", "packages/babel-core/lib/**/*.js.map");
}

module.exports = {
runner: supportsESMAndJestLightRunner ? "jest-light-runner" : "jest-runner",

Expand Down
4 changes: 3 additions & 1 deletion scripts/integration-tests/e2e-prettier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ startLocalRegistry "$root"/verdaccio-config.yml
yarn install --no-immutable
yarn info

# Without --runInBand CircleCI hangs.
# https://github.com/babel/babel/pull/14892#issuecomment-1233180626
echo "export default () => () => {}" > src/main/create-print-pre-check-function.js

yarn test "tests/format/(jsx?|misc|typescript|flow|flow-repo)/" --update-snapshot --runInBand

cleanup

0 comments on commit 9425eed

Please sign in to comment.