From d2f36169f30ac1e9bc8b2d1632af1aa51039af9d Mon Sep 17 00:00:00 2001 From: Monu-Chaudhary Date: Fri, 16 Sep 2022 17:53:18 -0400 Subject: [PATCH] test: use async/await in test-debugger-random-port-with-inspect-port PR-URL: https://github.com/nodejs/node/pull/44695 Reviewed-By: Rich Trott --- ...-debugger-random-port-with-inspect-port.js | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/test/sequential/test-debugger-random-port-with-inspect-port.js b/test/sequential/test-debugger-random-port-with-inspect-port.js index 5617e130f02585..3acc6bdd733eb0 100644 --- a/test/sequential/test-debugger-random-port-with-inspect-port.js +++ b/test/sequential/test-debugger-random-port-with-inspect-port.js @@ -1,6 +1,5 @@ 'use strict'; const common = require('../common'); - common.skipIfInspectorDisabled(); const fixtures = require('../common/fixtures'); @@ -9,22 +8,18 @@ const startCLI = require('../common/debugger'); const assert = require('assert'); // Random port with --inspect-port=0. -{ - const script = fixtures.path('debugger', 'three-lines.js'); +const script = fixtures.path('debugger', 'three-lines.js'); - const cli = startCLI(['--inspect-port=0', script]); +const cli = startCLI(['--inspect-port=0', script]); - cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { - assert.match(cli.output, /debug>/, 'prints a prompt'); - assert.match( - cli.output, - /< Debugger listening on /, - 'forwards child output'); - }) - .then(() => cli.quit()) - .then((code) => { - assert.strictEqual(code, 0); - }); -} +(async () => { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + assert.match(cli.output, /debug>/, 'prints a prompt'); + assert.match( + cli.output, + /< Debugger listening on /, + 'forwards child output'); + const code = await cli.quit(); + assert.strictEqual(code, 0); +})().then(common.mustCall());