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); + } +})();