3434 steps :
3535 - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
3636
37+ # macOS arm64 runners don't ship Node.js 10/12/14, so force x64.
3738 - uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
3839 id : calculate_architecture
3940 with :
@@ -50,34 +51,58 @@ jobs:
5051 with :
5152 node-version : ${{ matrix.node-version }}
5253 architecture : ${{ steps.calculate_architecture.outputs.result }}
53- # Legacy Node (10-16) reinstalls deps after dropping/bypassing
54- # package-lock.json, so there's no lockfile for setup-node's npm
55- # cache to key on.
54+ # Legacy Node (10-16) reinstalls deps after dropping the lockfile,
55+ # so there's nothing for setup-node's npm cache to key on.
5656 cache : ${{ (matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x') && '' || 'npm' }}
5757
58- - name : Install dependencies
58+ # TODO: drop the legacy install + jest steps below once `engines.node`
59+ # is bumped to >= 18. That also makes `jest.config.js`, the jest branch
60+ # of `test/_runner.js`, and `test/polyfill-text-encoding.js` dead code.
61+ #
62+ # The `node:test` based suite needs Node.js 18+; the library itself
63+ # still supports Node.js >= 10.13, so legacy versions run the same test
64+ # files under jest via the runner shim (`test/_runner.js`). jest, memfs
65+ # and the runtime deps are installed ad-hoc so the modern dev toolchain
66+ # (eslint, typescript, prettier) is never required by the legacy leg.
67+ - name : Install jest (Node 10)
68+ if : matrix.node-version == '10.x'
5969 shell : bash
6070 run : |
6171 rm -f package-lock.json
62-
6372 npm config set progress false
73+ yarn add -D jest@^27 memfs@^3 --ignore-scripts --ignore-engines
6474
65- if [ "${{ matrix.node-version }}" = "10.x" ]; then
66- yarn add -D typescript@^4 jest@^27 memfs@^3 --ignore-scripts --ignore-engines
67- else
68- npm install -g npm@7
69- npm install -D typescript@^4 jest@^27 memfs@^3 --ignore-scripts --no-audit --prefer-offline --no-save --no-package-lock
70- fi
71- if : matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x'
75+ - name : Install jest (Node 12-16)
76+ if : matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x'
77+ shell : bash
78+ run : |
79+ rm -f package-lock.json
80+ npm config set progress false
81+ npm install -g npm@7
82+ npm install -D jest@^27 memfs@^3 --ignore-scripts --no-audit --prefer-offline --no-save --no-package-lock
7283
7384 - name : Install dependencies
74- run : npm ci
7585 if : matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x'
86+ run : npm ci
87+
88+ - name : Run tests (legacy via jest)
89+ if : matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x'
90+ run : npx jest --ci
91+
92+ # The built-in coverage lcov reporter and `--test-coverage-include` are
93+ # only available on Node.js 22+, so 18/20 run the suite without
94+ # collecting coverage.
95+ - name : Run tests
96+ if : matrix.node-version == '18.x' || matrix.node-version == '20.x'
97+ run : npm run test:only
7698
7799 - name : Run tests with coverage
78- run : npm run test:coverage -- --ci
100+ if : matrix.node-version == '22.x' || matrix.node-version == '24.x' || matrix.node-version == '25.x'
101+ run : npm run test:coverage
79102
80103 - uses : codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
104+ if : matrix.node-version == '22.x' || matrix.node-version == '24.x' || matrix.node-version == '25.x'
81105 with :
106+ files : ./coverage/lcov.info
82107 flags : integration
83108 token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments