From b0e3e69686667d44f864127f570edabbc89ba291 Mon Sep 17 00:00:00 2001 From: MURAKAMI Masahiko Date: Fri, 12 Aug 2022 01:17:06 -0700 Subject: [PATCH] test: use `mustSucceed` instead of `mustCall` with `assert.ifError` PR-URL: https://github.com/nodejs/node/pull/44196 Reviewed-By: Antoine du Hamel Reviewed-By: Darshan Sen Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- test/sequential/test-inspector-open.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/sequential/test-inspector-open.js b/test/sequential/test-inspector-open.js index 847f0ab6926f67..93a2c74a0e4156 100644 --- a/test/sequential/test-inspector-open.js +++ b/test/sequential/test-inspector-open.js @@ -32,13 +32,12 @@ let firstPort; function firstOpen(msg) { assert.strictEqual(msg.cmd, 'url'); const port = url.parse(msg.url).port; - ping(port, (err) => { - assert.ifError(err); + ping(port, common.mustSucceed(() => { // Inspector is already open, and won't be reopened, so args don't matter. child.send({ cmd: 'open', args: [kOpenWhileOpen] }); child.once('message', common.mustCall(tryToOpenWhenOpen)); firstPort = port; - }); + })); } function tryToOpenWhenOpen(msg) { @@ -46,11 +45,10 @@ function tryToOpenWhenOpen(msg) { const port = url.parse(msg.url).port; // Reopen didn't do anything, the port was already open, and has not changed. assert.strictEqual(port, firstPort); - ping(port, (err) => { - assert.ifError(err); + ping(port, common.mustSucceed(() => { child.send({ cmd: 'close' }); child.once('message', common.mustCall(closeWhenOpen)); - }); + })); } function closeWhenOpen(msg) { @@ -73,10 +71,9 @@ function tryToCloseWhenClosed(msg) { function reopenAfterClose(msg) { assert.strictEqual(msg.cmd, 'url'); const port = url.parse(msg.url).port; - ping(port, (err) => { - assert.ifError(err); + ping(port, common.mustSucceed(() => { process.exit(); - }); + })); } function ping(port, callback) {