Skip to content

Commit dc5802d

Browse files
authored
test: improve long-lived-abort-controller test (#4621)
1 parent 9456d8f commit dc5802d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/fetch/long-lived-abort-controller.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ const { closeServerAsPromise } = require('../utils/node-http')
99
test('long-lived-abort-controller', async (t) => {
1010
const server = http.createServer({ joinDuplicateHeaders: true }, (req, res) => {
1111
res.writeHead(200, { 'Content-Type': 'text/plain' })
12-
res.write('Hello World!')
13-
res.end()
14-
}).listen(0)
12+
res.end('Hello World!')
13+
})
1514

16-
await once(server, 'listening')
15+
await once(server.listen(0), 'listening')
1716

1817
t.after(closeServerAsPromise(server))
1918

20-
let warningEmitted = false
21-
function onWarning () {
22-
warningEmitted = true
19+
let emittedWarning = ''
20+
function onWarning (warning) {
21+
emittedWarning = warning
2322
}
2423
process.on('warning', onWarning)
2524
t.after(() => {
@@ -42,5 +41,5 @@ test('long-lived-abort-controller', async (t) => {
4241
await res.text()
4342
}
4443

45-
t.assert.strictEqual(warningEmitted, false)
44+
t.assert.strictEqual(emittedWarning, '')
4645
})

0 commit comments

Comments
 (0)