@@ -23,14 +23,11 @@ server.listen(0, common.mustCall(async () => {
|
23 | 23 | rejectUnauthorized: false, |
24 | 24 | }); |
25 | 25 | |
26 | | -const assertAbort = async (socket, testName) => { |
27 | | -try { |
28 | | -await once(socket, 'close'); |
29 | | -assert.fail(`close ${testName} should have thrown`); |
30 | | -} catch (err) { |
31 | | -assert.strictEqual(err.name, 'AbortError'); |
32 | | -} |
33 | | -}; |
| 26 | +function assertAbort(socket, testName) { |
| 27 | +return assert.rejects(() => once(socket, 'close'), { |
| 28 | +name: 'AbortError', |
| 29 | +}, `close ${testName} should have thrown`); |
| 30 | +} |
34 | 31 | |
35 | 32 | async function postAbort() { |
36 | 33 | const ac = new AbortController(); |
|