From 9b88a6e3fad27d38f16ea0d6adfdf11b60041f35 Mon Sep 17 00:00:00 2001 From: archana-kamath Date: Fri, 16 Sep 2022 13:06:53 -0700 Subject: [PATCH] test: update test-debugger-breakpoint-exists.js to use async/await --- .../test-debugger-breakpoint-exists.js | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/test/sequential/test-debugger-breakpoint-exists.js b/test/sequential/test-debugger-breakpoint-exists.js index 7be0ba657fa981..4a9f32803c1c0b 100644 --- a/test/sequential/test-debugger-breakpoint-exists.js +++ b/test/sequential/test-debugger-breakpoint-exists.js @@ -8,20 +8,17 @@ const fixtures = require('../common/fixtures'); const startCLI = require('../common/debugger'); // Test for "Breakpoint at specified location already exists" error. -{ - const script = fixtures.path('debugger', 'three-lines.js'); - const cli = startCLI([script]); +const script = fixtures.path('debugger', 'three-lines.js'); +const cli = startCLI([script]); - function onFatal(error) { - cli.quit(); - throw error; +(async () => { + try { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.command('setBreakpoint(1)'); + await cli.command('setBreakpoint(1)'); + await cli.waitFor(/Breakpoint at specified location already exists/); + } finally { + await cli.quit(); } - - cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('setBreakpoint(1)')) - .then(() => cli.command('setBreakpoint(1)')) - .then(() => cli.waitFor(/Breakpoint at specified location already exists/)) - .then(() => cli.quit()) - .then(null, onFatal); -} +})();