Skip to content

Commit 0b360b7

Browse files
ci: fix Babel 8 and Node.js 6 jobs
- Target ie11 in the Gruntfile so the fixture is transpiled regardless of preset-env's default targets, which differ between Babel 7 and 8 (Babel 8 no longer lowers `class` by default, breaking the test assertion). - Install with --ignore-engines so eslint's newer Node.js requirement does not abort dependency installation on Node.js 6 (eslint runs in its own job). - Fix the matrix exclude to skip Node.js 6 + Babel 8 (Babel 8 needs Node 20+).
1 parent ca36166 commit 0b360b7

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
node: [6, 22, 24, 26]
1717
babel: [7, 8]
1818
exclude:
19-
# Babel 8 requires Node.js 20+, so it cannot run on Node.js 8.
20-
- node: 8
19+
# Babel 8 requires Node.js 20+, so it cannot run on Node.js 6.
20+
- node: 6
2121
babel: 8
2222
steps:
2323
- uses: actions/checkout@v4
@@ -28,7 +28,10 @@ jobs:
2828
node-version: ${{ matrix.node }}
2929

3030
- name: Install dependencies (Babel 7)
31-
run: yarn install --frozen-lockfile
31+
# --ignore-engines: dev-only tools such as eslint declare a newer
32+
# minimum Node.js version, but they are not executed in this job
33+
# (linting runs in its own job), so installing them on Node.js 6 is fine.
34+
run: yarn install --frozen-lockfile --ignore-engines
3235

3336
- name: Upgrade dev dependencies to Babel 8
3437
if: matrix.babel == 8

Gruntfile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ module.exports = function(grunt) {
55
compile: {
66
options: {
77
sourceMap: true,
8-
presets: ["@babel/preset-env"],
8+
// Target an old environment so that the test fixture is actually
9+
// transpiled (e.g. classes -> functions) regardless of the default
10+
// targets, which differ between Babel 7 and Babel 8.
11+
presets: [["@babel/preset-env", { targets: { ie: "11" } }]],
912
},
1013
files: {
1114
"test/tmp/fixture-compiled.js": "test/fixtures/fixture.js",

0 commit comments

Comments
 (0)