summaryrefslogtreecommitdiff
path: root/test/parallel/test-cli-node-options.js
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2017-07-12 12:27:28 -0400
committerRefael Ackermann <refack@gmail.com>2017-09-04 17:52:32 -0400
commit86e7c61a070d056daec9a756b86aece9ec30c2a8 (patch)
treeede9f8fab43d25e66fe7fbd72139056180ecab65 /test/parallel/test-cli-node-options.js
parentb24e269a482812193fb3cd8b6ced4477f8e5e1c5 (diff)
downloadandroid-node-v8-86e7c61a070d056daec9a756b86aece9ec30c2a8.tar.gz
android-node-v8-86e7c61a070d056daec9a756b86aece9ec30c2a8.tar.bz2
android-node-v8-86e7c61a070d056daec9a756b86aece9ec30c2a8.zip
test: split test-cli-node-options
* partitioning the subprocess groups * use `-e` instead of module * reduce maxBuffer PR-URL: https://github.com/nodejs/node/pull/14195 Fixes: https://github.com/nodejs/node/issues/14191 Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-cli-node-options.js')
-rw-r--r--test/parallel/test-cli-node-options.js54
1 files changed, 9 insertions, 45 deletions
diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js
index f52497e808..94cf6ca5fb 100644
--- a/test/parallel/test-cli-node-options.js
+++ b/test/parallel/test-cli-node-options.js
@@ -11,38 +11,7 @@ const exec = require('child_process').execFile;
common.refreshTmpDir();
process.chdir(common.tmpDir);
-disallow('--version');
-disallow('-v');
-disallow('--help');
-disallow('-h');
-disallow('--eval');
-disallow('-e');
-disallow('--print');
-disallow('-p');
-disallow('-pe');
-disallow('--check');
-disallow('-c');
-disallow('--interactive');
-disallow('-i');
-disallow('--v8-options');
-disallow('--');
-disallow('--no_warnings'); // Node options don't allow '_' instead of '-'.
-
-function disallow(opt) {
- const options = { env: Object.assign({}, process.env,
- { NODE_OPTIONS: opt }) };
- exec(process.execPath, options, common.mustCall(function(err) {
- const message = err.message.split(/\r?\n/)[1];
- const expect = `${process.execPath}: ${opt} is not allowed in NODE_OPTIONS`;
-
- assert.strictEqual(err.code, 9);
- assert.strictEqual(message, expect);
- }));
-}
-
-const printA = require.resolve('../fixtures/printA.js');
-
-expect(`-r ${printA}`, 'A\nB\n');
+expect(`-r ${require.resolve('../fixtures/printA.js')}`, 'A\nB\n');
expect('--no-deprecation', 'B\n');
expect('--no-warnings', 'B\n');
expect('--trace-warnings', 'B\n');
@@ -54,6 +23,7 @@ expect('--track-heap-objects', 'B\n');
expect('--throw-deprecation', 'B\n');
expect('--zero-fill-buffers', 'B\n');
expect('--v8-pool-size=10', 'B\n');
+
if (common.hasCrypto) {
expect('--use-openssl-ca', 'B\n');
expect('--use-bundled-ca', 'B\n');
@@ -61,26 +31,20 @@ if (common.hasCrypto) {
}
// V8 options
-expect('--abort-on-uncaught-exception', 'B\n');
-expect('--abort_on_uncaught_exception', 'B\n');
expect('--abort_on-uncaught_exception', 'B\n');
-expect('--max_old_space_size=0', 'B\n');
-expect('--max-old_space-size=0', 'B\n');
expect('--max-old-space-size=0', 'B\n');
function expect(opt, want) {
- const printB = require.resolve('../fixtures/printB.js');
- const argv = [printB];
+ const argv = ['-e', 'console.log("B")'];
const opts = {
env: Object.assign({}, process.env, { NODE_OPTIONS: opt }),
- maxBuffer: 1000000000,
+ maxBuffer: 1e6,
};
- exec(process.execPath, argv, opts, common.mustCall(function(err, stdout) {
+ exec(process.execPath, argv, opts, common.mustCall((err, stdout) => {
assert.ifError(err);
- if (!RegExp(want).test(stdout)) {
- console.error('For %j, failed to find %j in: <\n%s\n>',
- opt, want, stdout);
- assert.fail(`Expected ${want}`);
- }
+ if (stdout.includes(want)) return;
+
+ const o = JSON.stringify(opt);
+ assert.fail(`For ${o}, failed to find ${want} in: <\n${stdout}\n>`);
}));
}