summaryrefslogtreecommitdiff
path: root/test/parallel/test-cli-syntax-piped-good.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-cli-syntax-piped-good.js')
-rw-r--r--test/parallel/test-cli-syntax-piped-good.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/parallel/test-cli-syntax-piped-good.js b/test/parallel/test-cli-syntax-piped-good.js
index cdadf449d8..b2b02172cb 100644
--- a/test/parallel/test-cli-syntax-piped-good.js
+++ b/test/parallel/test-cli-syntax-piped-good.js
@@ -8,15 +8,31 @@ const node = process.execPath;
// Test both sets of arguments that check syntax
const syntaxArgs = [
- ['-c'],
- ['--check']
+ '-c',
+ '--check'
];
// Should not execute code piped from stdin with --check.
// Loop each possible option, `-c` or `--check`.
-syntaxArgs.forEach(function(args) {
+syntaxArgs.forEach(function(arg) {
const stdin = 'throw new Error("should not get run");';
- const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
+ const c = spawnSync(node, [arg], { encoding: 'utf8', input: stdin });
+
+ // No stdout or stderr should be produced
+ assert.strictEqual(c.stdout, '');
+ assert.strictEqual(c.stderr, '');
+
+ assert.strictEqual(c.status, 0);
+});
+
+// Check --entry-type=module
+syntaxArgs.forEach(function(arg) {
+ const stdin = 'export var p = 5; throw new Error("should not get run");';
+ const c = spawnSync(
+ node,
+ ['--experimental-modules', '--no-warnings', '--entry-type=module', arg],
+ { encoding: 'utf8', input: stdin }
+ );
// No stdout or stderr should be produced
assert.strictEqual(c.stdout, '');