From e609a3309c812c5d4563fee3e02e9b1c61f17a2f Mon Sep 17 00:00:00 2001 From: Juliet Zhang <65837446+zhangjuliet@users.noreply.github.com> Date: Thu, 29 Sep 2022 02:15:22 -0700 Subject: [PATCH] test: change promises to async/await in test-debugger-backtrace.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/44677 Reviewed-By: Rich Trott Reviewed-By: Tobias Nießen --- test/sequential/test-debugger-backtrace.js | 29 ++++++++++------------ 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/test/sequential/test-debugger-backtrace.js b/test/sequential/test-debugger-backtrace.js index f362e98068f15e..c189cb3f5b22e6 100644 --- a/test/sequential/test-debugger-backtrace.js +++ b/test/sequential/test-debugger-backtrace.js @@ -15,22 +15,19 @@ const path = require('path'); const script = path.relative(process.cwd(), scriptFullPath); const cli = startCLI([script]); - function onFatal(error) { - cli.quit(); - throw error; - } - - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.stepCommand('c')) - .then(() => cli.command('bt')) - .then(() => { + async function runTest() { + try { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.stepCommand('c'); + await cli.command('bt'); assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`)); - }) - .then(() => cli.command('backtrace')) - .then(() => { + await cli.command('backtrace'); assert.ok(cli.output.includes(`#0 topFn ${script}:7:2`)); - }) - .then(() => cli.quit()) - .then(null, onFatal); + } finally { + await cli.quit(); + } + } + + runTest(); }