blob: cdadf449d87b41b4014e883029a75a62b5a2e2d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
'use strict';
require('../common');
const assert = require('assert');
const { spawnSync } = require('child_process');
const node = process.execPath;
// Test both sets of arguments that check syntax
const syntaxArgs = [
['-c'],
['--check']
];
// Should not execute code piped from stdin with --check.
// Loop each possible option, `-c` or `--check`.
syntaxArgs.forEach(function(args) {
const stdin = 'throw new Error("should not get run");';
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
// No stdout or stderr should be produced
assert.strictEqual(c.stdout, '');
assert.strictEqual(c.stderr, '');
assert.strictEqual(c.status, 0);
});
|