From 5395b67f2f3558220d4aef99d4bc3cc419e9062f Mon Sep 17 00:00:00 2001 From: Rathi N Das Date: Fri, 16 Sep 2022 14:39:39 -0400 Subject: [PATCH 1/2] test: migrated from Promise chains to Async/Await --- .../test-debugger-restart-message.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/sequential/test-debugger-restart-message.js b/test/sequential/test-debugger-restart-message.js index bcd06b4e230131..8820563539c942 100644 --- a/test/sequential/test-debugger-restart-message.js +++ b/test/sequential/test-debugger-restart-message.js @@ -16,24 +16,24 @@ 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(); } + From ddb211579878c025243c8a517fed61d1e601c640 Mon Sep 17 00:00:00 2001 From: Rathi N Das Date: Sun, 18 Sep 2022 15:10:29 -0400 Subject: [PATCH 2/2] resolved the lint issue --- test/sequential/test-debugger-restart-message.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/sequential/test-debugger-restart-message.js b/test/sequential/test-debugger-restart-message.js index 8820563539c942..190d0c18ccc081 100644 --- a/test/sequential/test-debugger-restart-message.js +++ b/test/sequential/test-debugger-restart-message.js @@ -28,12 +28,10 @@ const startCLI = require('../common/debugger'); await cli.stepCommand('restart'); assert.strictEqual(cli.output.match(listeningRegExp).length, 1); } - } - finally{ + } finally { await cli.quit(); } } onWaitForInitialBreak(); } -