diff options
Diffstat (limited to 'deps/node/deps/node-inspect/test/cli/low-level.test.js')
-rw-r--r-- | deps/node/deps/node-inspect/test/cli/low-level.test.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/deps/node/deps/node-inspect/test/cli/low-level.test.js b/deps/node/deps/node-inspect/test/cli/low-level.test.js new file mode 100644 index 00000000..77e3fc2b --- /dev/null +++ b/deps/node/deps/node-inspect/test/cli/low-level.test.js @@ -0,0 +1,34 @@ +'use strict'; +const { test } = require('tap'); + +const startCLI = require('./start-cli'); + +test('Debugger agent direct access', (t) => { + const cli = startCLI(['examples/three-lines.js']); + const scriptPattern = /^\* (\d+): examples(?:\/|\\)three-lines.js/; + + function onFatal(error) { + cli.quit(); + throw error; + } + + return cli.waitForInitialBreak() + .then(() => cli.waitForPrompt()) + .then(() => cli.command('scripts')) + .then(() => { + const [, scriptId] = cli.output.match(scriptPattern); + return cli.command( + `Debugger.getScriptSource({ scriptId: '${scriptId}' })` + ); + }) + .then(() => { + t.match( + cli.output, + /scriptSource: '\(function \(/); + t.match( + cli.output, + /let x = 1;/); + }) + .then(() => cli.quit()) + .then(null, onFatal); +}); |