Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the fetch() abort test pass locally, on Linux and Mac, Node 18/19. #1927

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 2 additions & 13 deletions test/fetch/abort.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,14 @@ test('allows aborting with custom errors', { skip: semver.satisfies(process.vers
t.teardown(server.close.bind(server))
await once(server, 'listening')

t.test('Using AbortSignal.timeout without cause', { skip: semver.satisfies(process.version, '>= 19.0.0') }, async (t) => {
await t.rejects(
fetch(`http://localhost:${server.address().port}`, {
signal: AbortSignal.timeout(50)
}),
{
name: 'TimeoutError',
code: DOMException.TIMEOUT_ERR
}
)
})

t.test('Using AbortSignal.timeout with cause', { skip: semver.satisfies(process.version, '< 19.0.0') }, async (t) => {
t.test('Using AbortSignal.timeout with cause', async (t) => {
t.plan(2)

try {
await fetch(`http://localhost:${server.address().port}`, {
signal: AbortSignal.timeout(50)
})
t.fail('should throw')
} catch (err) {
if (err.name === 'TypeError') {
const cause = err.cause
Expand Down