@@ -30,20 +30,12 @@ jobs:
30
30
- macos-14
31
31
node-version :
32
32
- ' 22'
33
- - ' 20'
34
- - ' 18'
35
- - ' 16'
36
- - ' 14'
37
33
bundle :
38
34
- ' true'
39
35
include :
40
- - node-version : ' * '
36
+ - node-version : ' 22 '
41
37
bundle : false
42
38
os : ubuntu-latest
43
- exclude :
44
- # No Node 14 on ARM macOS
45
- - node-version : ' 14'
46
- os : macos-14
47
39
48
40
runs-on : ${{ matrix.os }}
49
41
name : Test Node ${{ matrix.node-version }} on ${{ matrix.os }}${{ (!matrix.bundle && ' with --no-bundle') || '' }}
@@ -55,19 +47,34 @@ jobs:
55
47
with :
56
48
node-version : ${{ matrix.node-version }}
57
49
check-latest : true
50
+
51
+ - run : |
52
+ echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
53
+ name: Enable require(ESM) and process.getBuiltinModule polyfill
54
+ id: node-options
55
+
56
+ - name : Verify that process.getBuiltinModule is available
57
+ run : node -e 'if (process.getBuiltinModule) { console.log(process.getBuiltinModule) } else { throw new Error("process.getBuiltinModule is not available") }'
58
+ env :
59
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
60
+
58
61
- run : npm ci
59
62
60
63
- name : Tests
61
64
id : test
62
65
# run tests, but lint separately
63
66
run : npm run test -- --no-lint --bundle=${{ matrix.bundle }}
67
+ env :
68
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
64
69
65
70
- name : Print baseline diff on failure
66
71
if : ${{ failure() && steps.test.conclusion == 'failure' }}
67
72
run : |
68
73
npx hereby baseline-accept
69
74
git add tests/baselines/reference
70
75
git diff --staged --exit-code
76
+ env :
77
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
71
78
72
79
lint :
73
80
runs-on : ubuntu-latest
@@ -145,6 +152,12 @@ jobs:
145
152
with :
146
153
node-version : ' *'
147
154
check-latest : true
155
+
156
+ - run : |
157
+ echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
158
+ name: Enable require(ESM) and process.getBuiltinModule polyfill
159
+ id: node-options
160
+
148
161
- run : |
149
162
npm --version
150
163
# corepack enable npm
@@ -154,12 +167,16 @@ jobs:
154
167
- run : npm ci
155
168
156
169
- run : npx hereby lkg
170
+ env :
171
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
157
172
- run : |
158
173
node ./scripts/addPackageJsonGitHead.mjs package.json
159
174
npm pack
160
175
mv typescript*.tgz typescript.tgz
161
- echo "package=$PWD /typescript.tgz" >> "$GITHUB_OUTPUT"
176
+ echo "package=$(pwd) /typescript.tgz" >> "$GITHUB_OUTPUT"
162
177
id: pack
178
+ env:
179
+ NODE_OPTIONS: ${{ steps.node-options.outputs.value }}
163
180
164
181
- name : Smoke test
165
182
run : |
@@ -175,6 +192,8 @@ jobs:
175
192
176
193
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript
177
194
node $GITHUB_WORKSPACE/scripts/checkModuleFormat.mjs typescript/lib/tsserverlibrary
195
+ env :
196
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
178
197
179
198
package-size :
180
199
runs-on : ubuntu-latest
@@ -243,18 +262,30 @@ jobs:
243
262
- uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
244
263
- uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
245
264
with :
246
- node-version : ' * '
265
+ node-version : ' 22 '
247
266
check-latest : true
267
+
268
+ - run : |
269
+ echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
270
+ name: Enable require(ESM) and process.getBuiltinModule polyfill
271
+ id: node-options
272
+
248
273
- run : npm ci
249
274
250
275
- name : Build tsc
251
276
run : npx hereby tsc
277
+ env :
278
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
252
279
253
280
- name : Clean
254
281
run : npx hereby clean-src
282
+ env :
283
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
255
284
256
285
- name : Self build
257
286
run : npx hereby build-src --built
287
+ env :
288
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
258
289
259
290
baselines :
260
291
runs-on : ubuntu-latest
@@ -263,20 +294,30 @@ jobs:
263
294
- uses : actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
264
295
- uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
265
296
with :
266
- node-version : ' * '
297
+ node-version : ' 22 '
267
298
check-latest : true
299
+
300
+ - run : |
301
+ echo "value=--no-warnings=ExperimentalWarning --experimental-require-module --require $(node -e 'console.log(path.resolve("patchProcessGetBuiltin.cjs"))')" >> "$GITHUB_OUTPUT"
302
+ name: Enable require(ESM) and process.getBuiltinModule polyfill
303
+ id: node-options
304
+
268
305
- run : npm ci
269
306
270
307
- name : Remove all baselines
271
308
run : rm -rf tests/baselines/reference
272
309
273
310
- name : Run tests
274
311
run : npm test &> /dev/null || exit 0
312
+ env :
313
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
275
314
276
315
- name : Accept baselines
277
316
run : |
278
317
npx hereby baseline-accept
279
318
git add tests/baselines/reference
319
+ env :
320
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
280
321
281
322
- name : Check baselines
282
323
id : check-baselines
@@ -295,6 +336,8 @@ jobs:
295
336
git diff --staged > fix_baselines.patch
296
337
exit 1
297
338
fi
339
+ env :
340
+ NODE_OPTIONS : ${{ steps.node-options.outputs.value }}
298
341
299
342
- name : Upload baseline diff artifact
300
343
if : ${{ failure() && steps.check-baselines.conclusion == 'failure' }}
0 commit comments