From 4f6d75c0b2f72bef3eb2df5e7fdc87e638ad49cb Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Sat, 27 Jan 2024 12:45:27 +0100 Subject: [PATCH] chore: reduce noice in test-logs test/issue-2349.js (#2655) --- test/issue-2349.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/test/issue-2349.js b/test/issue-2349.js index e8741a428a1..d6e0dcb2020 100644 --- a/test/issue-2349.js +++ b/test/issue-2349.js @@ -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() @@ -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 }, @@ -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') + ) })