Skip to content

Commit 8033ad8

Browse files
mmeenapriyadanielleadams
authored andcommitted
test: update test-debugger-scripts to use await/async
PR-URL: #44692 Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent f4f08be commit 8033ad8

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

test/sequential/test-debugger-scripts.js

+10-15
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@ const assert = require('assert');
1313
const script = fixtures.path('debugger', 'three-lines.js');
1414
const cli = startCLI([script]);
1515

16-
function onFatal(error) {
17-
cli.quit();
18-
throw error;
19-
}
20-
21-
return cli.waitForInitialBreak()
22-
.then(() => cli.waitForPrompt())
23-
.then(() => cli.command('scripts'))
24-
.then(() => {
16+
(async () => {
17+
try {
18+
await cli.waitForInitialBreak();
19+
await cli.waitForPrompt();
20+
await cli.command('scripts');
2521
assert.match(
2622
cli.output,
2723
/^\* \d+: \S+debugger(?:\/|\\)three-lines\.js/m,
@@ -30,9 +26,7 @@ const assert = require('assert');
3026
cli.output,
3127
/\d+: node:internal\/buffer/,
3228
'omits node-internal scripts');
33-
})
34-
.then(() => cli.command('scripts(true)'))
35-
.then(() => {
29+
await cli.command('scripts(true)');
3630
assert.match(
3731
cli.output,
3832
/\* \d+: \S+debugger(?:\/|\\)three-lines\.js/,
@@ -41,7 +35,8 @@ const assert = require('assert');
4135
cli.output,
4236
/\d+: node:internal\/buffer/,
4337
'includes node-internal scripts');
44-
})
45-
.then(() => cli.quit())
46-
.then(null, onFatal);
38+
} finally {
39+
await cli.quit();
40+
}
41+
})().then(common.mustCall());
4742
}

0 commit comments

Comments
 (0)