Skip to content

Commit 4ffe63b

Browse files
committed
test: make pass when run on Node.js >22.13
After nodejs/node#55816, getMaxListeners() throws by default when called on AbortSignal. Turns out that it's not necessary to use it, just any value will do as the test guarantees that there's a single listener anyway.
1 parent 7f3efb2 commit 4ffe63b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/completion-listener.spec.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getEventListeners, getMaxListeners } from 'events';
1+
import { getEventListeners } from 'events';
22
import { TestScheduler } from 'rxjs/testing';
33

44
import { CloseEvent } from './command';
@@ -59,9 +59,8 @@ describe('listen', () => {
5959

6060
it('does not leak memory when listening for abort signals', () => {
6161
const abortCtrl = new AbortController();
62-
const maxListeners = getMaxListeners(abortCtrl.signal);
6362
createController().listen(
64-
Array.from({ length: maxListeners + 1 }, () => new FakeCommand()),
63+
Array.from({ length: 10 }, () => new FakeCommand()),
6564
abortCtrl.signal,
6665
);
6766
expect(getEventListeners(abortCtrl.signal, 'abort')).toHaveLength(1);

0 commit comments

Comments
 (0)