Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions test/issue-2349.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'use strict'

const { test } = require('tap')
const { test } = require('node:test')
const { rejects } = require('node:assert')
const { Writable } = require('stream')
const { MockAgent, stream } = require('..')

test('stream() does not fail after request has been aborted', async (t) => {
t.plan(1)

test('stream() does not fail after request has been aborted', () => {
const mockAgent = new MockAgent()

mockAgent.disableNetConnect()
Expand All @@ -23,8 +22,8 @@ test('stream() does not fail after request has been aborted', async (t) => {

setTimeout(() => ac.abort(), 5)

try {
await stream(
rejects(
stream(
'http://localhost:3333/',
{
opaque: { parts },
Expand All @@ -39,9 +38,7 @@ test('stream() does not fail after request has been aborted', async (t) => {
}
})
}
)
} catch (error) {
console.log(error)
t.equal(error instanceof DOMException, true)
}
),
new DOMException('This operation was aborted', 'AbortError')
)
})