Skip to content

Commit

Permalink
Gate AbortController tests
Browse files Browse the repository at this point in the history
We also test Node.js 14 which doesn't support AbortController
  • Loading branch information
eps1lon committed Feb 9, 2023
1 parent 25d1857 commit c9aae2a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/__tests__/waitForNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ test('ensures the given callback is a function', () => {
)
})

const testAbortController =
typeof AbortController === 'undefined' ? test.skip : test

describe('using fake modern timers', () => {
beforeEach(() => {
jest.useFakeTimers('modern')
Expand Down Expand Up @@ -220,7 +223,7 @@ describe('using fake modern timers', () => {
`)
})

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

test('does not even ping if the signal is already aborted', async () => {
testAbortController('does not even ping if the signal is already aborted', async () => {
const callback = jest.fn(() => {
throw new Error('not done')
})
Expand Down

0 comments on commit c9aae2a

Please sign in to comment.