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
diff options
context:
space:
mode:
author“Pooja <pakcutie14@gmail.com>2022-09-16 23:48:53 +0300
committerRich Trott <rtrott@gmail.com>2022-09-23 16:42:13 +0300
commit269aa6ebba6bbbc1b179099919387ead7e1d02f7 (patch)
tree552bba890c19226406e72f865bcf5e0baf29e1e6
parente213deabe5e513e996bf6c2d7028ed049baab41b (diff)
test: change promise to async/await in debugger-watcher
PR-URL: https://github.com/nodejs/node/pull/44687 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
-rw-r--r--test/sequential/test-debugger-watchers.js48
-rw-r--r--test/sequential/test-debugger-watchers.mjs49
2 files changed, 49 insertions, 48 deletions
diff --git a/test/sequential/test-debugger-watchers.js b/test/sequential/test-debugger-watchers.js
deleted file mode 100644
index e856132b74e..00000000000
--- a/test/sequential/test-debugger-watchers.js
+++ /dev/null
@@ -1,48 +0,0 @@
-'use strict';
-const common = require('../common');
-
-common.skipIfInspectorDisabled();
-
-const fixtures = require('../common/fixtures');
-const startCLI = require('../common/debugger');
-
-const assert = require('assert');
-
-// Stepping through breakpoints.
-{
- const cli = startCLI([fixtures.path('debugger/break.js')]);
-
- function onFatal(error) {
- cli.quit();
- throw error;
- }
-
- return cli.waitForInitialBreak()
- .then(() => cli.waitForPrompt())
- .then(() => cli.command('watch("x")'))
- .then(() => cli.command('watch("\\"Hello\\"")'))
- .then(() => cli.command('watch("42")'))
- .then(() => cli.command('watch("NaN")'))
- .then(() => cli.command('watch("true")'))
- .then(() => cli.command('watch("[1, 2]")'))
- .then(() => cli.command('watch("process.env")'))
- .then(() => cli.command('watchers'))
- .then(() => {
- assert.match(cli.output, /x is not defined/);
- })
- .then(() => cli.command('unwatch("42")'))
- .then(() => cli.stepCommand('n'))
- .then(() => {
- assert.match(cli.output, /0: x = 10/);
- assert.match(cli.output, /1: "Hello" = 'Hello'/);
- assert.match(cli.output, /2: NaN = NaN/);
- assert.match(cli.output, /3: true = true/);
- assert.match(cli.output, /4: \[1, 2\] = \[ 1, 2 \]/);
- assert.match(
- cli.output,
- /5: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/,
- 'shows "..." for process.env');
- })
- .then(() => cli.quit())
- .then(null, onFatal);
-}
diff --git a/test/sequential/test-debugger-watchers.mjs b/test/sequential/test-debugger-watchers.mjs
new file mode 100644
index 00000000000..2c4fd11545f
--- /dev/null
+++ b/test/sequential/test-debugger-watchers.mjs
@@ -0,0 +1,49 @@
+import { skipIfInspectorDisabled } from '../common/index.mjs';
+skipIfInspectorDisabled();
+
+import { path } from '../common/fixtures.mjs';
+import startCLI from '../common/debugger.js';
+
+import assert from 'assert';
+
+const script = path('debugger', 'break.js');
+const cli = startCLI([script]);
+
+function onFatal(error) {
+ cli.quit();
+ throw error;
+}
+
+// Stepping through breakpoints.
+try {
+ await cli.waitForInitialBreak();
+ await cli.waitForPrompt();
+ await cli.command('watch("x")');
+ await cli.command('watch("\\"Hello\\"")');
+ await cli.command('watch("42")');
+ await cli.command('watch("NaN")');
+ await cli.command('watch("true")');
+ await cli.command('watch("[1, 2]")');
+ await cli.command('watch("process.env")');
+ await cli.command('watchers');
+
+ assert.match(cli.output, /x is not defined/);
+
+ await cli.command('unwatch("42")');
+ await cli.stepCommand('n');
+
+ assert.match(cli.output, /0: x = 10/);
+ assert.match(cli.output, /1: "Hello" = 'Hello'/);
+ assert.match(cli.output, /2: NaN = NaN/);
+ assert.match(cli.output, /3: true = true/);
+ assert.match(cli.output, /4: \[1, 2\] = \[ 1, 2 \]/);
+ assert.match(
+ cli.output,
+ /5: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/,
+ 'shows "..." for process.env'
+ );
+
+ await cli.quit();
+} catch (error) {
+ onFatal(error);
+}