| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 94882f5 commit 2b7eb56
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -197,6 +197,7 @@ debug> | |||
| 197 | 197 | after) | |
| 198 | 198 | * `watch(expr)`: Add expression to watch list | |
| 199 | 199 | * `unwatch(expr)`: Remove expression from watch list | |
| 200 | + * `unwatch(index)`: Remove expression at specific index from watch list | ||
| 200 | 201 | * `watchers`: List all watchers and their values (automatically listed on each | |
| 201 | 202 | breakpoint) | |
| 202 | 203 | * `repl`: Open debugger's repl for evaluation in debugging script's context | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -91,6 +91,7 @@ breakOnNone Don't pause on exceptions (this is the default) | |||
| 91 | 91 | ||
| 92 | 92 | watch(expr) Start watching the given expression | |
| 93 | 93 | unwatch(expr) Stop watching an expression | |
| 94 | + unwatch(index) Stop watching an expression at specific index from watch list | ||
| 94 | 95 | watchers Print all watched expressions and their current values | |
| 95 | 96 | ||
| 96 | 97 | exec(expr), p(expr), exec expr, p expr | |
@@ -1078,6 +1079,7 @@ function createRepl(inspector) { | |||
| 1078 | 1079 | }, | |
| 1079 | 1080 | ||
| 1080 | 1081 | watch(expr) { | |
| 1082 | + validateString(expr, 'expression'); | ||
| 1081 | 1083 | ArrayPrototypePush(watchedExpressions, expr); | |
| 1082 | 1084 | }, | |
| 1083 | 1085 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + | ||
| 4 | + common.skipIfInspectorDisabled(); | ||
| 5 | + | ||
| 6 | + const fixtures = require('../common/fixtures'); | ||
| 7 | + const startCLI = require('../common/debugger'); | ||
| 8 | + | ||
| 9 | + const assert = require('assert'); | ||
| 10 | + | ||
| 11 | + const cli = startCLI([fixtures.path('debugger/break.js')]); | ||
| 12 | + | ||
| 13 | + (async () => { | ||
| 14 | + await cli.waitForInitialBreak(); | ||
| 15 | + await cli.command('watch()'); | ||
| 16 | + await cli.waitFor(/ERR_INVALID_ARG_TYPE/); | ||
| 17 | + assert.match(cli.output, /TypeError \[ERR_INVALID_ARG_TYPE\]: The "expression" argument must be of type string\. Received undefined/); | ||
| 18 | + })() | ||
| 19 | + .finally(() => cli.quit()) | ||
| 20 | + .then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,18 +28,25 @@ try { | |||
| 28 | 28 | await cli.command('watchers'); | |
| 29 | 29 | ||
| 30 | 30 | assert.match(cli.output, /x is not defined/); | |
| 31 | - | ||
| 31 | + assert.match(cli.output, /1: "Hello" = 'Hello'/); | ||
| 32 | + assert.match(cli.output, /2: 42 = 42/); | ||
| 33 | + assert.match(cli.output, /3: NaN = NaN/); | ||
| 34 | + assert.match(cli.output, /4: true = true/); | ||
| 35 | + assert.match(cli.output, /5: \[1, 2\] = \[ 1, 2 \]/); | ||
| 36 | + assert.match(cli.output, /6: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, | ||
| 37 | + 'shows "..." for process.env'); | ||
| 38 | + | ||
| 39 | + await cli.command('unwatch(4)'); | ||
| 32 | 40 | await cli.command('unwatch("42")'); | |
| 33 | 41 | await cli.stepCommand('n'); | |
| 34 | 42 | ||
| 35 | 43 | assert.match(cli.output, /0: x = 10/); | |
| 36 | 44 | assert.match(cli.output, /1: "Hello" = 'Hello'/); | |
| 37 | 45 | assert.match(cli.output, /2: NaN = NaN/); | |
| 38 | - assert.match(cli.output, /3: true = true/); | ||
| 39 | - assert.match(cli.output, /4: \[1, 2\] = \[ 1, 2 \]/); | ||
| 46 | + assert.match(cli.output, /3: \[1, 2\] = \[ 1, 2 \]/); | ||
| 40 | 47 | assert.match( | |
| 41 | 48 | cli.output, | |
| 42 | - /5: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, | ||
| 49 | + /4: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, | ||
| 43 | 50 | 'shows "..." for process.env' | |
| 44 | 51 | ); | |
| 45 | 52 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments