From 22a5f233b232768f59d91212aee4346db5e29470 Mon Sep 17 00:00:00 2001 From: cola119 Date: Wed, 27 Apr 2022 21:18:17 +0900 Subject: [PATCH 1/3] doc: add information on unwatch(index) option --- doc/api/debugger.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/debugger.md b/doc/api/debugger.md index 8c91a10ddd8b36..92f1d9c1066409 100644 --- a/doc/api/debugger.md +++ b/doc/api/debugger.md @@ -194,6 +194,7 @@ debug> after) * `watch(expr)`: Add expression to watch list * `unwatch(expr)`: Remove expression from watch list +* `unwatch(index)`: Remove expression at specific index from watch list * `watchers`: List all watchers and their values (automatically listed on each breakpoint) * `repl`: Open debugger's repl for evaluation in debugging script's context From d1af4cb7ac9de62997431fb12b9ca6832c826150 Mon Sep 17 00:00:00 2001 From: cola119 Date: Thu, 28 Apr 2022 09:29:39 +0900 Subject: [PATCH 2/3] test: add test for watch(index) command --- test/sequential/test-debugger-watchers.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/sequential/test-debugger-watchers.js b/test/sequential/test-debugger-watchers.js index e856132b74e28a..4be3840875aa7c 100644 --- a/test/sequential/test-debugger-watchers.js +++ b/test/sequential/test-debugger-watchers.js @@ -29,18 +29,27 @@ const assert = require('assert'); .then(() => cli.command('watchers')) .then(() => { assert.match(cli.output, /x is not defined/); + assert.match(cli.output, /1: "Hello" = 'Hello'/); + assert.match(cli.output, /2: 42 = 42/); + assert.match(cli.output, /3: NaN = NaN/); + assert.match(cli.output, /4: true = true/); + assert.match(cli.output, /5: \[1, 2\] = \[ 1, 2 \]/); + assert.match( + cli.output, + /6: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, + 'shows "..." for process.env'); }) + .then(() => cli.command('unwatch(4)')) .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, /3: \[1, 2\] = \[ 1, 2 \]/); assert.match( cli.output, - /5: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, + /4: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, 'shows "..." for process.env'); }) .then(() => cli.quit()) From 9bcd75cf038fa7685c7560e371a5d06c21bc3c17 Mon Sep 17 00:00:00 2001 From: cola119 Date: Tue, 10 May 2022 06:56:46 +0900 Subject: [PATCH 3/3] debugger: add help document for watch(index) --- lib/internal/debugger/inspect_repl.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/internal/debugger/inspect_repl.js b/lib/internal/debugger/inspect_repl.js index 49b41ef2af311f..fbfdbb545a9b30 100644 --- a/lib/internal/debugger/inspect_repl.js +++ b/lib/internal/debugger/inspect_repl.js @@ -92,6 +92,7 @@ breakOnNone Don't pause on exceptions (this is the default) watch(expr) Start watching the given expression unwatch(expr) Stop watching an expression +unwatch(index) Stop watching an expression at specific index from watch list watchers Print all watched expressions and their current values exec(expr), p(expr), exec expr, p expr