Skip to content
Permalink
Browse files
test: use async/await in test-debugger-random-port-with-inspect-port
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 d2f36169f30ac1e9bc8b2d1632af1aa51039af9d
Showing 1 changed file with 13 additions and 18 deletions.
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

const fixtures = require('../common/fixtures');
@@ -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.