Skip to content

Commit 087241e

Browse files
[babel 8] breaking: bump minimum required Node.js to 14.17 (#14206)
* breaking: bump babel 8 target to node 14.15 * cast env to bool * use jest-light-worker for recent node versions * bump Babel 8 node requirements to >=14.17 * Update jest.config.js Co-authored-by: Nicolò Ribaudo <[email protected]> Co-authored-by: Nicolò Ribaudo <[email protected]>
1 parent 8ccd121 commit 087241e

5 files changed

Lines changed: 17 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ jobs:
197197
steps:
198198
- name: Checkout code
199199
uses: actions/checkout@v2
200-
- name: Use Node.js 12
200+
- name: Use Node.js 14.17
201201
uses: actions/setup-node@v2-beta
202202
with:
203-
node-version: 12 # Node.js 12 is the first LTS supported by Babel 8
203+
node-version: "14.17" # Node.js 14.17 is the first LTS supported by Babel 8
204204
- name: Get yarn cache directory path
205205
id: yarn-cache-dir-path
206206
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = function (api) {
6262

6363
let transformRuntimeOptions;
6464

65-
const nodeVersion = "6.9";
65+
const nodeVersion = bool(process.env.BABEL_8_BREAKING) ? "14.17" : "6.9";
6666
// The vast majority of our src files are modules, but we use
6767
// unambiguous to keep things simple until we get around to renaming
6868
// the modules to be more easily distinguished from CommonJS

jest.config.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
const supportsESM = parseInt(process.versions.node) >= 12;
1+
const semver = require("semver");
2+
const nodeVersion = process.versions.node;
3+
const supportsESMAndJestLightRunner = semver.satisfies(
4+
nodeVersion,
5+
// ^12.22 || >=14.17 : Node will throw "t.isIdentifier is not a function" when test is running in worker threads.
6+
// ^13.7: `resolve.exports` specifies conditional exports in package.json
7+
"^12.22 || ^13.7 || >=14.17"
8+
);
29
const isPublishBundle = process.env.IS_PUBLISH;
310

411
module.exports = {
5-
runner: supportsESM ? "./test/jest-light-runner" : "jest-runner",
12+
runner: supportsESMAndJestLightRunner
13+
? "./test/jest-light-runner"
14+
: "jest-runner",
615

716
collectCoverageFrom: [
817
"packages/*/src/**/*.{js,mjs,ts}",
@@ -12,7 +21,7 @@ module.exports = {
1221
// The eslint/* packages use ESLint v6, which has dropped support for Node v6.
1322
// TODO: Remove this process.version check in Babel 8.
1423
testRegex: `./(packages|codemods${
15-
Number(process.versions.node.split(".")[0]) < 10 ? "" : "|eslint"
24+
semver.satisfies(nodeVersion, "<10") ? "" : "|eslint"
1625
})/[^/]+/test/.+\\.m?js$`,
1726
testPathIgnorePatterns: [
1827
"/node_modules/",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"rollup-plugin-dts": "^2.0.0",
7474
"rollup-plugin-node-polyfills": "^0.2.1",
7575
"rollup-plugin-terser": "^7.0.2",
76+
"semver": "^6.3.0",
7677
"test262-stream": "^1.4.0",
7778
"through2": "^4.0.0",
7879
"typescript": "~4.5.0"

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5876,6 +5876,7 @@ __metadata:
58765876
rollup-plugin-dts: ^2.0.0
58775877
rollup-plugin-node-polyfills: ^0.2.1
58785878
rollup-plugin-terser: ^7.0.2
5879+
semver: ^6.3.0
58795880
test262-stream: ^1.4.0
58805881
through2: ^4.0.0
58815882
typescript: ~4.5.0

0 commit comments

Comments
 (0)