From a3ac77479da2fb333f6507d9914f557ad548e59b Mon Sep 17 00:00:00 2001 From: Monu-Chaudhary Date: Fri, 16 Sep 2022 17:53:18 -0400 Subject: [PATCH] test:update test-debugger-random-port-with-inspect-port.js to use await/async --- ...-debugger-random-port-with-inspect-port.js | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 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..b122f69c039381 100644 --- a/test/sequential/test-debugger-random-port-with-inspect-port.js +++ b/test/sequential/test-debugger-random-port-with-inspect-port.js @@ -9,22 +9,21 @@ 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 () => { + try { + await cli.waitForInitialBreak() + await cli.waitForPrompt() + assert.match(cli.output, /debug>/, 'prints a prompt'); + assert.match( + cli.output, + /< Debugger listening on /, + 'forwards child output'); + } finally { + const code = cli.quit() + assert.strictEqual(code,0); + } +})();