Skip to content

Commit

Permalink
test: use async/await in test-debugger-profile
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhirjain committed Sep 18, 2022
1 parent 95b0014 commit beec29a
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions test/sequential/test-debugger-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}

0 comments on commit beec29a

Please sign in to comment.