From a7666abe312bc20ab6456367f769c4f268795b6d Mon Sep 17 00:00:00 2001 From: Rathi N Das Date: Thu, 29 Sep 2022 05:15:32 -0400 Subject: [PATCH] test: migrated from Promise chains to Async/Await PR-URL: https://github.com/nodejs/node/pull/44674 Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat --- .../test-debugger-restart-message.js | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/test/sequential/test-debugger-restart-message.js b/test/sequential/test-debugger-restart-message.js index bcd06b4e230131..190d0c18ccc081 100644 --- a/test/sequential/test-debugger-restart-message.js +++ b/test/sequential/test-debugger-restart-message.js @@ -16,24 +16,22 @@ const startCLI = require('../common/debugger'); const script = fixtures.path('debugger', 'three-lines.js'); const cli = startCLI([script]); - function onFatal(error) { - cli.quit(); - throw error; - } - const listeningRegExp = /Debugger listening on/g; - cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => { + async function onWaitForInitialBreak() { + try { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); assert.strictEqual(cli.output.match(listeningRegExp).length, 1); - }) - .then(async () => { + for (let i = 0; i < RESTARTS; i++) { await cli.stepCommand('restart'); assert.strictEqual(cli.output.match(listeningRegExp).length, 1); } - }) - .then(() => cli.quit()) - .then(null, onFatal); + } finally { + await cli.quit(); + } + } + + onWaitForInitialBreak(); }