From 1b8bdb331bf26cccdf99081f2bdc77174a862ba3 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Sat, 27 Jan 2024 12:03:05 +0100 Subject: [PATCH] chore: reduce noice in test-logs test/issue-2349.js --- 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') + ) })