Skip to content

Commit c9aae2a

Browse files
committed
Gate AbortController tests
We also test Node.js 14 which doesn't support AbortController
1 parent 25d1857 commit c9aae2a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/__tests__/waitForNode.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ test('ensures the given callback is a function', () => {
7474
)
7575
})
7676

77+
const testAbortController =
78+
typeof AbortController === 'undefined' ? test.skip : test
79+
7780
describe('using fake modern timers', () => {
7881
beforeEach(() => {
7982
jest.useFakeTimers('modern')
@@ -220,7 +223,7 @@ describe('using fake modern timers', () => {
220223
`)
221224
})
222225

223-
test('can be aborted with an AbortSignal', async () => {
226+
testAbortController('can be aborted with an AbortSignal', async () => {
224227
const callback = jest.fn(() => {
225228
throw new Error('not done')
226229
})
@@ -238,7 +241,7 @@ describe('using fake modern timers', () => {
238241
expect(callback).toHaveBeenCalledTimes(2)
239242
})
240243

241-
test('does not even ping if the signal is already aborted', async () => {
244+
testAbortController('does not even ping if the signal is already aborted', async () => {
242245
const callback = jest.fn(() => {
243246
throw new Error('not done')
244247
})

0 commit comments

Comments
 (0)