Skip to content

Commit

Permalink
test: modify test-debugger-custom-port.js to use async-await
Browse files Browse the repository at this point in the history
PR-URL: #44680
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
pshastricb authored and juanarbol committed Oct 4, 2022
1 parent b5ac163 commit e3c456a
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions test/sequential/test-debugger-custom-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@ const startCLI = require('../common/debugger');
const assert = require('assert');

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

const cli = startCLI([`--port=${common.PORT}`, script]);

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => {
assert.match(cli.output, /debug>/, 'prints a prompt');
assert.match(
cli.output,
new RegExp(`< Debugger listening on [^\n]*${common.PORT}`),
'forwards child output');
})
.then(() => cli.quit())
.then((code) => {
assert.strictEqual(code, 0);
});
}
const cli = startCLI([`--port=${common.PORT}`, script]);
(async function() {
try {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
assert.match(cli.output, /debug>/, 'prints a prompt');
assert.match(
cli.output,
new RegExp(`< Debugger listening on [^\n]*${common.PORT}`),
'forwards child output');
} finally {
const code = await cli.quit();
assert.strictEqual(code, 0);
}
})().then(common.mustCall());

0 comments on commit e3c456a

Please sign in to comment.