Skip to content
Permalink
Browse files
test: change promises to async/await in test-debugger-backtrace.js
PR-URL: #44677
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
zhangjuliet authored and danielleadams committed Oct 5, 2022
1 parent eeabd23 commit e609a3309c812c5d4563fee3e02e9b1c61f17a2f
Showing 1 changed file with 13 additions and 16 deletions.
@@ -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();
}

0 comments on commit e609a33

Please sign in to comment.