node/test/parallel/test-cli-syntax-piped-good.js
Ruben Bridgewater 50dd555910
doc,lib,test: capitalize comment sentences
This activates the eslint capitalize comment rule for comments
above 50 characters.

PR-URL: https://github.com/nodejs/node/pull/24996
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-17 17:14:35 +01:00

27 lines
679 B
JavaScript

'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);
});