Skip to content

Commit ace5eb4

Browse files
authored
chore: bump CI to use 20.19.4, 22.18.0, 24.6.0 (#5430)
1 parent cbcf007 commit ace5eb4

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

.github/workflows/mocha.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ jobs:
6666
with:
6767
os: 'ubuntu-latest,windows-latest'
6868
# We pin exact versions here per https://github.com/mochajs/mocha/issues/5052
69-
# Use 20.18.3 per https://github.com/mochajs/mocha/issues/5278
7069
# Ref https://nodejs.org/en/about/previous-releases
71-
node-versions: '18.20.8,20.18.3,22.17.1,24.4.1'
70+
node-versions: '18.20.8,20.19.4,22.18.0,24.6.0'
7271
npm-script: test-node:${{ matrix.test-part }}
7372
coverage: ${{ matrix.coverage }}
7473

test/integration/plugins/root-hooks.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe('root hooks', function () {
153153
// (introduced in Node 20.10.0, 21.1.0)
154154
// newer versions of Node no longer fail :)
155155
if (isNewerVersion(process.versions.node)) {
156-
return true; // skip test on newer Node versions
156+
return true; // skip suite on newer Node versions
157157
}
158158

159159
const filename =
@@ -200,7 +200,7 @@ describe('root hooks', function () {
200200

201201
describe('on newer versions, should work', function () {
202202
if (!isNewerVersion(process.versions.node)) {
203-
return true; // skip test on older Node versions
203+
return true; // skip suite on older Node versions
204204
}
205205

206206
const filename =
@@ -227,7 +227,7 @@ describe('root hooks', function () {
227227
invokeMochaAsync(
228228
[
229229
'--require=' + require.resolve(filename), // as object
230-
// enabled by default in these newer versions, but clearer to use it explicitly
230+
// enabled by default in these newer versions, but clearer to use it explicitly
231231
'--experimental-detect-module'
232232
],
233233
'pipe'

test/node-unit/reporters/parallel-buffered.spec.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ const {
2121
const {EventEmitter} = require('node:events');
2222
const sinon = require('sinon');
2323
const rewiremock = require('rewiremock/node');
24+
const semver = require('semver');
2425

2526
describe('ParallelBuffered', function () {
27+
/** @type {EventEmitter} */
2628
let runner;
2729
let ParallelBuffered;
2830

@@ -102,7 +104,19 @@ describe('ParallelBuffered', function () {
102104
describe('on EVENT_RUN_END', function () {
103105
it('should remove all listeners', function () {
104106
runner.emit(EVENT_RUN_END);
105-
expect(runner.listeners(), 'to be empty');
107+
// Some node versions throw instead of returning `[]` due to a bug
108+
// Fix is in Node ^22.14 and ^24.0, but not yet backported to 20 as of writing
109+
// Problem was introduced in 20.19.0, not present in 20.18.3
110+
// https://github.com/nodejs/node/issues/56263
111+
const nodeVersionThrows = semver.satisfies(
112+
process.versions.node,
113+
'^20.19.0 || >=22.0.0 <22.14.0'
114+
);
115+
if (nodeVersionThrows) {
116+
expect(runner.listeners, 'to throw');
117+
} else {
118+
expect(runner.listeners(), 'to be empty');
119+
}
106120
});
107121
});
108122

0 commit comments

Comments
 (0)