|
| 1 | +import{skipIfInspectorDisabled}from'../common/index.mjs'; |
| 2 | +skipIfInspectorDisabled(); |
| 3 | + |
| 4 | +import{path}from'../common/fixtures.mjs'; |
| 5 | +importstartCLIfrom'../common/debugger.js'; |
| 6 | + |
| 7 | +importassertfrom'assert'; |
| 8 | + |
| 9 | +constscript=path('debugger','break.js'); |
| 10 | +constcli=startCLI([script]); |
| 11 | + |
| 12 | +functiononFatal(error){ |
| 13 | +cli.quit(); |
| 14 | +throwerror; |
| 15 | +} |
| 16 | + |
| 17 | +// Stepping through breakpoints. |
| 18 | +try{ |
| 19 | +awaitcli.waitForInitialBreak(); |
| 20 | +awaitcli.waitForPrompt(); |
| 21 | +awaitcli.command('watch("x")'); |
| 22 | +awaitcli.command('watch("\\"Hello\\"")'); |
| 23 | +awaitcli.command('watch("42")'); |
| 24 | +awaitcli.command('watch("NaN")'); |
| 25 | +awaitcli.command('watch("true")'); |
| 26 | +awaitcli.command('watch("[1, 2]")'); |
| 27 | +awaitcli.command('watch("process.env")'); |
| 28 | +awaitcli.command('watchers'); |
| 29 | + |
| 30 | +assert.match(cli.output,/xisnotdefined/); |
| 31 | + |
| 32 | +awaitcli.command('unwatch("42")'); |
| 33 | +awaitcli.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 | +awaitcli.quit(); |
| 47 | +}catch(error){ |
| 48 | +onFatal(error); |
| 49 | +} |
0 commit comments