Skip to content

Commit

Permalink
test: update test-debugger-scripts to use await/async
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeenapriya committed Sep 16, 2022
1 parent 5d92ddc commit 4d5fe19
Showing 1 changed file with 28 additions and 35 deletions.
63 changes: 28 additions & 35 deletions test/sequential/test-debugger-scripts.js
Expand Up @@ -9,39 +9,32 @@ const startCLI = require('../common/debugger');
const assert = require('assert');

// List scripts.
{
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([script]);
const script = fixtures.path('debugger', 'three-lines.js');
const cli = startCLI([script]);

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

return cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => cli.command('scripts'))
.then(() => {
assert.match(
cli.output,
/^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m,
'lists the user script');
assert.doesNotMatch(
cli.output,
/\d+: node:internal\/buffer/,
'omits node-internal scripts');
})
.then(() => cli.command('scripts(true)'))
.then(() => {
assert.match(
cli.output,
/\* \d+: \S+debugger(?:\/|\\)three-lines\.js/,
'lists the user script');
assert.match(
cli.output,
/\d+: node:internal\/buffer/,
'includes node-internal scripts');
})
.then(() => cli.quit())
.then(null, onFatal);
}
(async () => {
try{
await cli.waitForInitialBreak();
await cli.waitForPrompt();
await cli.command('scripts');
assert.match(
cli.output,
/^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m,
'lists the user script');
assert.doesNotMatch(
cli.output,
/\d+: node:internal\/buffer/,
'omits node-internal scripts');
await cli.command('scripts(true)');
assert.match(
cli.output,
/\* \d+: \S+debugger(?:\/|\\)three-lines\.js/,
'lists the user script');
assert.match(
cli.output,
/\d+: node:internal\/buffer/,
'includes node-internal scripts');
} finally {
cli.quit()
}
})()

0 comments on commit 4d5fe19

Please sign in to comment.