| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,49 @@ | |||
| 1 | + import { skipIfInspectorDisabled } from '../common/index.mjs'; | ||
| 2 | + skipIfInspectorDisabled(); | ||
| 3 | + | ||
| 4 | + import { path } from '../common/fixtures.mjs'; | ||
| 5 | + import startCLI from '../common/debugger.js'; | ||
| 6 | + | ||
| 7 | + import assert from 'assert'; | ||
| 8 | + | ||
| 9 | + const script = path('debugger', 'break.js'); | ||
| 10 | + const cli = startCLI([script]); | ||
| 11 | + | ||
| 12 | + function onFatal(error) { | ||
| 13 | + cli.quit(); | ||
| 14 | + throw error; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + // Stepping through breakpoints. | ||
| 18 | + try { | ||
| 19 | + await cli.waitForInitialBreak(); | ||
| 20 | + await cli.waitForPrompt(); | ||
| 21 | + await cli.command('watch("x")'); | ||
| 22 | + await cli.command('watch("\\"Hello\\"")'); | ||
| 23 | + await cli.command('watch("42")'); | ||
| 24 | + await cli.command('watch("NaN")'); | ||
| 25 | + await cli.command('watch("true")'); | ||
| 26 | + await cli.command('watch("[1, 2]")'); | ||
| 27 | + await cli.command('watch("process.env")'); | ||
| 28 | + await cli.command('watchers'); | ||
| 29 | + | ||
| 30 | + assert.match(cli.output, /x is not defined/); | ||
| 31 | + | ||
| 32 | + await cli.command('unwatch("42")'); | ||
| 33 | + await cli.stepCommand('n'); | ||
| 34 | + | ||
| 35 | + assert.match(cli.output, /0: x = 10/); | ||
| 36 | + assert.match(cli.output, /1: "Hello" = 'Hello'/); | ||
| 37 | + 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 \]/); | ||
| 40 | + assert.match( | ||
| 41 | + cli.output, | ||
| 42 | + /5: process\.env =\n\s+\{[\s\S]+,\n\s+\.\.\. \}/, | ||
| 43 | + 'shows "..." for process.env' | ||
| 44 | + ); | ||
| 45 | + | ||
| 46 | + await cli.quit(); | ||
| 47 | + } catch (error) { | ||
| 48 | + onFatal(error); | ||
| 49 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments