From 88f48e0b569db8f6590c656e8bf97feee0fa4ea1 Mon Sep 17 00:00:00 2001 From: cola119 Date: Thu, 21 Apr 2022 08:23:01 +0900 Subject: [PATCH] test: refactor into async-await --- test/sequential/test-debugger-list.js | 40 ++++++++++++--------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/test/sequential/test-debugger-list.js b/test/sequential/test-debugger-list.js index ba6fa1e801df3f..2adc904c0c763a 100644 --- a/test/sequential/test-debugger-list.js +++ b/test/sequential/test-debugger-list.js @@ -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());