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
  • Loading branch information
pshastricb authored and tniessen committed Sep 16, 2022
1 parent 5d92ddc commit 6da72b2
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions test/sequential/test-debugger-custom-port.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
use strict';
const common = require('../common');

common.skipIfInspectorDisabled();
Expand All @@ -9,22 +9,21 @@ 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);
}
})();

0 comments on commit 6da72b2

Please sign in to comment.