summaryrefslogtreecommitdiff
path: root/deps/node-inspect/test/cli/start-cli.js
diff options
context:
space:
mode:
authorJan Krems <jan.krems@groupon.com>2017-04-04 09:47:43 -0700
committerAnna Henningsen <anna@addaleax.net>2017-04-14 23:48:05 +0200
commit021719738eb8bc86356e23fe3902d2900a878fd6 (patch)
treed5398ccba2c9149cc700d470444534c66e82a25d /deps/node-inspect/test/cli/start-cli.js
parent7fd2923f1fcce9a782d450f01ad414589030c596 (diff)
downloadandroid-node-v8-021719738eb8bc86356e23fe3902d2900a878fd6.tar.gz
android-node-v8-021719738eb8bc86356e23fe3902d2900a878fd6.tar.bz2
android-node-v8-021719738eb8bc86356e23fe3902d2900a878fd6.zip
deps: update node-inspect to v1.11.2
PR-URL: https://github.com/nodejs/node/pull/12363 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Diffstat (limited to 'deps/node-inspect/test/cli/start-cli.js')
-rw-r--r--deps/node-inspect/test/cli/start-cli.js30
1 files changed, 25 insertions, 5 deletions
diff --git a/deps/node-inspect/test/cli/start-cli.js b/deps/node-inspect/test/cli/start-cli.js
index 267aac57f4..ae904308e0 100644
--- a/deps/node-inspect/test/cli/start-cli.js
+++ b/deps/node-inspect/test/cli/start-cli.js
@@ -1,11 +1,21 @@
'use strict';
const spawn = require('child_process').spawn;
+// This allows us to keep the helper inside of `test/` without tap warning
+// about "pending" test files.
+const tap = require('tap');
+tap.test('startCLI', (t) => t.end());
+
const CLI =
process.env.USE_EMBEDDED_NODE_INSPECT === '1' ?
'inspect' :
require.resolve('../../cli.js');
+const BREAK_MESSAGE = new RegExp('(?:' + [
+ 'assert', 'break', 'break on start', 'debugCommand',
+ 'exception', 'other', 'promiseRejection',
+].join('|') + ') in', 'i');
+
function startCLI(args) {
const child = spawn(process.execPath, [CLI, ...args]);
let isFirstStdoutChunk = true;
@@ -88,6 +98,16 @@ function startCLI(args) {
return this.waitFor(/>\s+$/, timeout);
},
+ waitForInitialBreak(timeout = 2000) {
+ return this.waitFor(/break (?:on start )?in/i, timeout)
+ .then(() => {
+ if (/Break on start/.test(this.output)) {
+ return this.command('next', false)
+ .then(() => this.waitFor(/break in/, timeout));
+ }
+ });
+ },
+
ctrlC() {
return this.command('.interrupt');
},
@@ -107,8 +127,10 @@ function startCLI(args) {
.map((match) => +match[1]);
},
- command(input) {
- this.flushOutput();
+ command(input, flush = true) {
+ if (flush) {
+ this.flushOutput();
+ }
child.stdin.write(input);
child.stdin.write('\n');
return this.waitForPrompt();
@@ -119,9 +141,7 @@ function startCLI(args) {
child.stdin.write(input);
child.stdin.write('\n');
return this
- .waitFor(
- /(?:assert|break|debugCommand|exception|other|promiseRejection) in/
- )
+ .waitFor(BREAK_MESSAGE)
.then(() => this.waitForPrompt());
},