Skip to content
Permalink
Browse files
test: migrated from Promise chains to Async/Await
PR-URL: #44674
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
rathi2016 authored and danielleadams committed Oct 5, 2022
1 parent e609a33 commit 143c428cae123db9244453f210a7abac181ec8aa
Showing 1 changed file with 11 additions and 13 deletions.
@@ -16,24 +16,22 @@ const startCLI = require('../common/debugger');
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([script]);

function onFatal(error) {
cli.quit();
throw error;
}

const listeningRegExp = /Debugger listening on/g;

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => {
async function onWaitForInitialBreak() {
try {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
})
.then(async () => {

for (let i = 0; i < RESTARTS; i++) {
await cli.stepCommand('restart');
assert.strictEqual(cli.output.match(listeningRegExp).length, 1);
}
})
.then(() => cli.quit())
.then(null, onFatal);
} finally {
await cli.quit();
}
}

onWaitForInitialBreak();
}

0 comments on commit 143c428

Please sign in to comment.