Skip to content

Commit fea4682

Browse files
committed
test: refactor into async-await
1 parent 2206bd0 commit fea4682

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

test/sequential/test-debugger-list.js

+17-23
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,20 @@ const assert = require('assert');
1010

1111
const cli = startCLI([fixtures.path('debugger/three-lines.js')]);
1212

13-
cli.waitForInitialBreak()
14-
.then(() => cli.waitForPrompt())
15-
.then(() => cli.command('list(0)'))
16-
.then(() => {
17-
assert.match(cli.output, /> 1 let x = 1;/);
18-
})
19-
.then(() => cli.command('list(1)'))
20-
.then(() => {
21-
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;/);
22-
})
23-
.then(() => cli.command('list(10)'))
24-
.then(() => {
25-
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;\n {2}3 module\.exports = x;\n {2}4 /);
26-
})
27-
.then(() => cli.command('c'))
28-
.then(() => cli.waitFor(/disconnect/))
29-
.then(() => cli.waitFor(/debug> $/))
30-
.then(() => cli.command('list()'))
31-
.then(() => {
32-
assert.match(cli.output, /Uncaught Error \[ERR_DEBUGGER_ERROR\]: Requires execution to be paused/);
33-
})
34-
.finally(() => cli.quit())
35-
.then(common.mustCall());
13+
(async () => {
14+
await cli.waitForInitialBreak();
15+
await cli.waitForPrompt();
16+
await cli.command('list(0)');
17+
assert.match(cli.output, /> 1 let x = 1;/);
18+
await cli.command('list(1)');
19+
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;/);
20+
await cli.command('list(10)');
21+
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;\n {2}3 module\.exports = x;\n {2}4 /);
22+
await cli.command('c');
23+
await cli.waitFor(/disconnect/);
24+
await cli.waitFor(/debug> $/);
25+
await cli.command('list()');
26+
assert.match(cli.output, /Uncaught Error \[ERR_DEBUGGER_ERROR\]: Requires execution to be paused/);
27+
})()
28+
.finally(() => cli.quit())
29+
.then(common.mustCall());

0 commit comments

Comments
 (0)