Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: refactor into async-await
  • Loading branch information
cola119 committed Apr 22, 2022
commit 88f48e0b569db8f6590c656e8bf97feee0fa4ea1
40 changes: 17 additions & 23 deletions test/sequential/test-debugger-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,20 @@ const assert = require('assert');

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

cli.waitForInitialBreak()
.then(() => cli.waitForPrompt())
.then(() => cli.command('list(0)'))
.then(() => {
assert.match(cli.output, /> 1 let x = 1;/);
})
.then(() => cli.command('list(1)'))
.then(() => {
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;/);
})
.then(() => cli.command('list(10)'))
.then(() => {
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;\n {2}3 module\.exports = x;\n {2}4 /);
})
.then(() => cli.command('c'))
.then(() => cli.waitFor(/disconnect/))
.then(() => cli.waitFor(/debug> $/))
.then(() => cli.command('list()'))
.then(() => {
assert.match(cli.output, /Uncaught Error \[ERR_DEBUGGER_ERROR\]: Requires execution to be paused/);
})
.finally(() => cli.quit())
.then(common.mustCall());
(async () => {
await cli.waitForInitialBreak();
await cli.waitForPrompt();
await cli.command('list(0)');
assert.match(cli.output, /> 1 let x = 1;/);
await cli.command('list(1)');
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;/);
await cli.command('list(10)');
assert.match(cli.output, /> 1 let x = 1;\n {2}2 x = x \+ 1;\n {2}3 module\.exports = x;\n {2}4 /);
await cli.command('c');
await cli.waitFor(/disconnect/);
await cli.waitFor(/debug> $/);
await cli.command('list()');
assert.match(cli.output, /Uncaught Error \[ERR_DEBUGGER_ERROR\]: Requires execution to be paused/);
})()
.finally(() => cli.quit())
.then(common.mustCall());