Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHope Olaidé <79100769+hopeolaide@users.noreply.github.com>2022-09-29 12:15:10 +0300
committerDanielle Adams <adamzdanielle@gmail.com>2022-10-05 13:54:15 +0300
commiteeabd23ca686f7a4add65e5e6cc9ddb8ab680686 (patch)
treecaab7cee38c0060f87217f5055ee8263da497727 /test
parent5c63d1464ef014dc7eb504c2925f47a5189e2938 (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.js53
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());