Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update test-debugger-scripts to use await/async #44692

Merged
merged 5 commits into from
Sep 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions test/sequential/test-debugger-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ const assert = require('assert');
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(() => {
(async () => {
try {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
await cli.command('scripts');
assert.match(
cli.output,
/^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m,
Expand All @@ -30,9 +26,7 @@ const assert = require('assert');
cli.output,
/\d+: node:internal\/buffer/,
'omits node-internal scripts');
})
.then(() => cli.command('scripts(true)'))
.then(() => {
await cli.command('scripts(true)');
assert.match(
cli.output,
/\* \d+: \S+debugger(?:\/|\\)three-lines\.js/,
Expand All @@ -41,7 +35,8 @@ const assert = require('assert');
cli.output,
/\d+: node:internal\/buffer/,
'includes node-internal scripts');
})
.then(() => cli.quit())
.then(null, onFatal);
} finally {
await cli.quit();
}
})().then(common.mustCall());
}