From 89f3feb364e04ca61aff43328fe94c2d8c1012db Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 21 Feb 2025 12:39:44 +0100 Subject: [PATCH] test: improve error output of test-http2-client-promisify-connect-error PR-URL: https://github.com/nodejs/node/pull/57135 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- .../test-http2-client-promisify-connect-error.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-http2-client-promisify-connect-error.js b/test/parallel/test-http2-client-promisify-connect-error.js index 44ff4a28181..b3c8bc980aa 100644 --- a/test/parallel/test-http2-client-promisify-connect-error.js +++ b/test/parallel/test-http2-client-promisify-connect-error.js @@ -12,13 +12,10 @@ const server = http2.createServer(); server.listen(0, common.mustCall(() => { const port = server.address().port; - server.close(() => { + server.close(common.mustCall(() => { const connect = util.promisify(http2.connect); - connect(`http://localhost:${port}`) - .then(common.mustNotCall('Promise should not be resolved')) - .catch(common.mustCall((err) => { - assert(err instanceof Error); - assert.strictEqual(err.code, 'ECONNREFUSED'); - })); - }); + assert.rejects(connect(`http://localhost:${port}`), { + code: 'ECONNREFUSED' + }).then(common.mustCall()); + })); }));