diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-10-25 19:51:58 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-11-03 01:04:07 +0100 |
commit | 89b3228f4d1a7f00b8ff195964895061e45861d1 (patch) | |
tree | 8e8e94dcefc01426db5967bef18a3cbc64214c08 /test/parallel/test-cli-node-options.js | |
parent | 8bb2a2d18eb4af099161000127c9cf394fbdfd1c (diff) | |
download | android-node-v8-89b3228f4d1a7f00b8ff195964895061e45861d1.tar.gz android-node-v8-89b3228f4d1a7f00b8ff195964895061e45861d1.tar.bz2 android-node-v8-89b3228f4d1a7f00b8ff195964895061e45861d1.zip |
cli: add --stack-trace-limit to NODE_OPTIONS
I decided that it would make a lot of sense for me to set
`NODE_OPTIONS=--stack-trace-limit=100` on my development machine.
This code allows me to do that. :)
PR-URL: https://github.com/nodejs/node/pull/16495
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ryan Graham <r.m.graham@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'test/parallel/test-cli-node-options.js')
-rw-r--r-- | test/parallel/test-cli-node-options.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 94cf6ca5fb..07c99a57c6 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -33,16 +33,26 @@ if (common.hasCrypto) { // V8 options expect('--abort_on-uncaught_exception', 'B\n'); expect('--max-old-space-size=0', 'B\n'); +expect('--stack-trace-limit=100', + /(\s*at f \(\[eval\]:1:\d*\)\n){100}/, + '(function f() { f(); })();', + true); -function expect(opt, want) { - const argv = ['-e', 'console.log("B")']; +function expect(opt, want, command = 'console.log("B")', wantsError = false) { + const argv = ['-e', command]; const opts = { env: Object.assign({}, process.env, { NODE_OPTIONS: opt }), maxBuffer: 1e6, }; - exec(process.execPath, argv, opts, common.mustCall((err, stdout) => { - assert.ifError(err); - if (stdout.includes(want)) return; + if (typeof want === 'string') + want = new RegExp(want); + exec(process.execPath, argv, opts, common.mustCall((err, stdout, stderr) => { + if (wantsError) { + stdout = stderr; + } else { + assert.ifError(err); + } + if (want.test(stdout)) return; const o = JSON.stringify(opt); assert.fail(`For ${o}, failed to find ${want} in: <\n${stdout}\n>`); |