Skip to content

Commit

Permalink
test: use async/await in test-debugger-random-port-with-inspect-port
Browse files Browse the repository at this point in the history
PR-URL: #44695
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
Monu-Chaudhary authored and danielleadams committed Oct 5, 2022
1 parent ddf0297 commit d2f3616
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions test/sequential/test-debugger-random-port-with-inspect-port.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

const fixtures = require('../common/fixtures');
Expand All @@ -9,22 +8,18 @@ const startCLI = require('../common/debugger');
const assert = require('assert');

// Random port with --inspect-port=0.
{
const script = fixtures.path('debugger', 'three-lines.js');
const script = fixtures.path('debugger', 'three-lines.js');

const cli = startCLI(['--inspect-port=0', script]);
const cli = startCLI(['--inspect-port=0', script]);

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => {
assert.match(cli.output, /debug>/, 'prints a prompt');
assert.match(
cli.output,
/< Debugger listening on /,
'forwards child output');
})
.then(() => cli.quit())
.then((code) => {
assert.strictEqual(code, 0);
});
}
(async () => {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
assert.match(cli.output, /debug>/, 'prints a prompt');
assert.match(
cli.output,
/< Debugger listening on /,
'forwards child output');
const code = await cli.quit();
assert.strictEqual(code, 0);
})().then(common.mustCall());

0 comments on commit d2f3616

Please sign in to comment.