Skip to content

Commit

Permalink
test: use async/await in test-debugger-invalid-args
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#44678
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
nupurchauhan6 authored and guangwong committed Jan 3, 2023
1 parent 2a02416 commit 6fbaaac
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions test/sequential/test-debugger-invalid-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,20 @@ const startCLI = require('../common/debugger');
const assert = require('assert');

// Launch CLI w/o args.
{
(async () => {
const cli = startCLI([]);
cli.quit()
.then((code) => {
assert.strictEqual(code, 1);
assert.match(cli.output, /^Usage:/, 'Prints usage info');
});
}
const code = await cli.quit();
assert.strictEqual(code, 1);
assert.match(cli.output, /^Usage:/, 'Prints usage info');
})().then(common.mustCall());

// Launch w/ invalid host:port.
{
(async () => {
const cli = startCLI([`localhost:${common.PORT}`]);
cli.quit()
.then((code) => {
assert.match(
cli.output,
/failed to connect/,
'Tells the user that the connection failed');
assert.strictEqual(code, 1);
});
}
const code = await cli.quit();
assert.match(
cli.output,
/failed to connect/,
'Tells the user that the connection failed');
assert.strictEqual(code, 1);
})().then(common.mustCall());

0 comments on commit 6fbaaac

Please sign in to comment.