From beec29aeadadbbb128ef05a519604932a591c184 Mon Sep 17 00:00:00 2001 From: Surbhi Jain Date: Sun, 18 Sep 2022 11:05:21 -0500 Subject: [PATCH] test: use async/await in test-debugger-profile --- test/sequential/test-debugger-profile.js | 50 ++++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/test/sequential/test-debugger-profile.js b/test/sequential/test-debugger-profile.js index 707e45ce0d593c..bf4a69720022cd 100644 --- a/test/sequential/test-debugger-profile.js +++ b/test/sequential/test-debugger-profile.js @@ -9,33 +9,33 @@ const startCLI = require('../common/debugger'); const assert = require('assert'); function delay(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } // Profiles. { - const cli = startCLI([fixtures.path('debugger/empty.js')]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - try { - (async () => { - await cli.waitForInitialBreak(); - await cli.waitForPrompt(); - await cli.command('exec console.profile()'); - assert.match(cli.output, /undefined/); - await cli.command('exec console.profileEnd()'); - await delay(250) - assert.match(cli.output, /undefined/); - assert.match(cli.output, /Captured new CPU profile\./); - await cli.quit(); - })() - .then(common.mustCall()) - } catch(error) { - return onFatal(error) - } - + const cli = startCLI([fixtures.path('debugger/empty.js')]); + + function onFatal(error) { + cli.quit(); + throw error; + } + + try { + (async () => { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.command('exec console.profile()'); + assert.match(cli.output, /undefined/); + await cli.command('exec console.profileEnd()'); + await delay(250); + assert.match(cli.output, /undefined/); + assert.match(cli.output, /Captured new CPU profile\./); + await cli.quit(); + })() + .then(common.mustCall()); + } catch (error) { + return onFatal(error); + } + }