Skip to content

Commit

Permalink
test: use mustSucceed instead of mustCall with assert.ifError
Browse files Browse the repository at this point in the history
PR-URL: #44196
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
fossamagna authored and danielleadams committed Aug 16, 2022
1 parent 3359c2c commit b0e3e69
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/sequential/test-inspector-open.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,23 @@ 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) {
assert.strictEqual(msg.cmd, 'url');
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) {
Expand All @@ -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) {
Expand Down

0 comments on commit b0e3e69

Please sign in to comment.