From b376047236c046bb1b4d6c704c1070ce79cf7178 Mon Sep 17 00:00:00 2001 From: surbhirjain <36057179+surbhirjain@users.noreply.github.com> Date: Tue, 27 Sep 2022 11:32:41 -0500 Subject: [PATCH] test: use async/await in test-debugger-profile PR-URL: https://github.com/nodejs/node/pull/44684 Reviewed-By: Rich Trott --- test/sequential/test-debugger-profile.js | 25 +++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/test/sequential/test-debugger-profile.js b/test/sequential/test-debugger-profile.js index 992c6f71c00775..bf4a69720022cd 100644 --- a/test/sequential/test-debugger-profile.js +++ b/test/sequential/test-debugger-profile.js @@ -21,18 +21,21 @@ function delay(ms) { throw error; } - return cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('exec console.profile()')) - .then(() => { + try { + (async () => { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.command('exec console.profile()'); assert.match(cli.output, /undefined/); - }) - .then(() => cli.command('exec console.profileEnd()')) - .then(() => delay(250)) - .then(() => { + await cli.command('exec console.profileEnd()'); + await delay(250); assert.match(cli.output, /undefined/); assert.match(cli.output, /Captured new CPU profile\./); - }) - .then(() => cli.quit()) - .then(null, onFatal); + await cli.quit(); + })() + .then(common.mustCall()); + } catch (error) { + return onFatal(error); + } + }