From 7bed33fa3277e23522e5f0ffb295227806845ee4 Mon Sep 17 00:00:00 2001 From: Priya Shastri <97130930+pshastricb@users.noreply.github.com> Date: Fri, 16 Sep 2022 12:29:07 -0700 Subject: [PATCH] test: modify test-debugger-custom-port.js to use async-await --- test/sequential/test-debugger-custom-port.js | 37 ++++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/test/sequential/test-debugger-custom-port.js b/test/sequential/test-debugger-custom-port.js index e6cee10ffa53b5..6c413809b29f16 100644 --- a/test/sequential/test-debugger-custom-port.js +++ b/test/sequential/test-debugger-custom-port.js @@ -1,4 +1,4 @@ -'use strict'; +use strict'; const common = require('../common'); common.skipIfInspectorDisabled(); @@ -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); + } +})();