Skip to content

Commit fc94a74

Browse files
committed
test: update test-debugger-low-level to use await/async
1 parent 5d92ddc commit fc94a74

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

test/sequential/test-debugger-low-level.js

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,25 @@ const assert = require('assert');
1212
const cli = startCLI([fixtures.path('debugger/three-lines.js')]);
1313
const scriptPattern = /^\* (\d+): \S+debugger(?:\/|\\)three-lines\.js/m;
1414

15-
function onFatal(error) {
16-
cli.quit();
17-
throw error;
18-
}
19-
20-
return cli.waitForInitialBreak()
21-
.then(() => cli.waitForPrompt())
22-
.then(() => cli.command('scripts'))
23-
.then(() => {
15+
async function testDebuggerLowLevel()
16+
{
17+
try{
18+
await cli.waitForInitialBreak();
19+
await cli.waitForPrompt();
20+
await cli.command('scripts');
2421
const [, scriptId] = cli.output.match(scriptPattern);
25-
return cli.command(
22+
await cli.command(
2623
`Debugger.getScriptSource({ scriptId: '${scriptId}' })`
2724
);
28-
})
29-
.then(() => {
3025
assert.match(
31-
cli.output,
32-
/scriptSource:[ \n]*'(?:\(function \(|let x = 1)/);
26+
cli.output,
27+
/scriptSource:[ \n]*'(?:\(function \(|let x = 1)/);
3328
assert.match(
34-
cli.output,
35-
/let x = 1;/);
36-
})
37-
.then(() => cli.quit())
38-
.then(null, onFatal);
29+
cli.output,
30+
/let x = 1;/);
31+
} finally{
32+
await cli.quit();
33+
}
34+
}
35+
testDebuggerLowLevel();
3936
}

0 commit comments

Comments
 (0)