Skip to content

Commit 9864bde

Browse files
pshastricbdanielleadams
authored andcommitted
test: modify test-debugger-custom-port.js to use async-await
PR-URL: #44680 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent f92871a commit 9864bde

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

test/sequential/test-debugger-custom-port.js

+16-18
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,20 @@ const startCLI = require('../common/debugger');
99
const assert = require('assert');
1010

1111
// Custom port.
12-
{
13-
const script = fixtures.path('debugger', 'three-lines.js');
12+
const script = fixtures.path('debugger', 'three-lines.js');
1413

15-
const cli = startCLI([`--port=${common.PORT}`, script]);
16-
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-
new RegExp(`< Debugger listening on [^\n]*${common.PORT}`),
24-
'forwards child output');
25-
})
26-
.then(() => cli.quit())
27-
.then((code) => {
28-
assert.strictEqual(code, 0);
29-
});
30-
}
14+
const cli = startCLI([`--port=${common.PORT}`, script]);
15+
(async function() {
16+
try {
17+
await cli.waitForInitialBreak();
18+
await cli.waitForPrompt();
19+
assert.match(cli.output, /debug>/, 'prints a prompt');
20+
assert.match(
21+
cli.output,
22+
new RegExp(`< Debugger listening on [^\n]*${common.PORT}`),
23+
'forwards child output');
24+
} finally {
25+
const code = await cli.quit();
26+
assert.strictEqual(code, 0);
27+
}
28+
})().then(common.mustCall());

0 commit comments

Comments
 (0)