Skip to content

Commit d2f3616

Browse files
Monu-Chaudharydanielleadams
authored andcommitted
test: use async/await in test-debugger-random-port-with-inspect-port
PR-URL: #44695 Reviewed-By: Rich Trott <[email protected]>
1 parent ddf0297 commit d2f3616

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
const common = require('../common');
3-
43
common.skipIfInspectorDisabled();
54

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

1110
// Random port with --inspect-port=0.
12-
{
13-
const script = fixtures.path('debugger', 'three-lines.js');
11+
const script = fixtures.path('debugger', 'three-lines.js');
1412

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

17-
cli.waitForInitialBreak()
18-
.then(() => cli.waitForPrompt())
19-
.then(() => {
20-
assert.match(cli.output, /debug>/, 'prints a prompt');
21-
assert.match(
22-
cli.output,
23-
/< Debugger listening on /,
24-
'forwards child output');
25-
})
26-
.then(() => cli.quit())
27-
.then((code) => {
28-
assert.strictEqual(code, 0);
29-
});
30-
}
15+
(async () => {
16+
await cli.waitForInitialBreak();
17+
await cli.waitForPrompt();
18+
assert.match(cli.output, /debug>/, 'prints a prompt');
19+
assert.match(
20+
cli.output,
21+
/< Debugger listening on /,
22+
'forwards child output');
23+
const code = await cli.quit();
24+
assert.strictEqual(code, 0);
25+
})().then(common.mustCall());

0 commit comments

Comments
 (0)