diff options
author | Hope Olaidé <79100769+hopeolaide@users.noreply.github.com> | 2022-09-29 12:15:10 +0300 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2022-10-05 13:54:15 +0300 |
commit | eeabd23ca686f7a4add65e5e6cc9ddb8ab680686 (patch) | |
tree | caab7cee38c0060f87217f5055ee8263da497727 /test | |
parent | 5c63d1464ef014dc7eb504c2925f47a5189e2938 (diff) |
test: use async/await in test-debugger-sb-before-load
PR-URL: https://github.com/nodejs/node/pull/44697
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test')
-rw-r--r-- | test/sequential/test-debugger-sb-before-load.js | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/test/sequential/test-debugger-sb-before-load.js b/test/sequential/test-debugger-sb-before-load.js index 586687800e8..e2267156b74 100644 --- a/test/sequential/test-debugger-sb-before-load.js +++ b/test/sequential/test-debugger-sb-before-load.js @@ -10,35 +10,24 @@ const assert = require('assert'); const path = require('path'); // Using sb before loading file. -{ - const scriptFullPath = fixtures.path('debugger', 'cjs', 'index.js'); - const script = path.relative(process.cwd(), scriptFullPath); - - const otherScriptFullPath = fixtures.path('debugger', 'cjs', 'other.js'); - const otherScript = path.relative(process.cwd(), otherScriptFullPath); - - const cli = startCLI([script]); - - function onFatal(error) { - cli.quit(); - throw error; - } - - cli.waitForInitialBreak() - .then(() => cli.waitForPrompt()) - .then(() => cli.command('sb("other.js", 2)')) - .then(() => { - assert.match( - cli.output, - /not loaded yet/, - 'warns that the script was not loaded yet'); - }) - .then(() => cli.stepCommand('cont')) - .then(() => { - assert.ok( - cli.output.includes(`break in ${otherScript}:2`), - 'found breakpoint in file that was not loaded yet'); - }) - .then(() => cli.quit()) - .then(null, onFatal); -} + +const scriptFullPath = fixtures.path('debugger', 'cjs', 'index.js'); +const script = path.relative(process.cwd(), scriptFullPath); + +const otherScriptFullPath = fixtures.path('debugger', 'cjs', 'other.js'); +const otherScript = path.relative(process.cwd(), otherScriptFullPath); + +const cli = startCLI([script]); + +(async () => { + await cli.waitForInitialBreak(); + await cli.waitForPrompt(); + await cli.command('sb("other.js", 2)'); + assert.match(cli.output, /not loaded yet/, + 'warns that the script was not loaded yet'); + await cli.stepCommand('cont'); + assert.ok(cli.output.includes(`break in ${otherScript}:2`), + 'found breakpoint in file that was not loaded yet'); +})() +.then(common.mustCall()) +.finally(() => cli.quit()); |