mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 03:12:57 +00:00

Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
36 lines
816 B
JavaScript
36 lines
816 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var spawn = require('child_process').spawn;
|
|
|
|
if (process.argv[2] === 'parent')
|
|
parent();
|
|
else
|
|
grandparent();
|
|
|
|
function grandparent() {
|
|
var child = spawn(process.execPath, [__filename, 'parent']);
|
|
child.stderr.pipe(process.stderr);
|
|
var output = '';
|
|
var input = 'asdfasdf';
|
|
|
|
child.stdout.on('data', function(chunk) {
|
|
output += chunk;
|
|
});
|
|
child.stdout.setEncoding('utf8');
|
|
|
|
child.stdin.end(input);
|
|
|
|
child.on('close', function(code, signal) {
|
|
assert.equal(code, 0);
|
|
assert.equal(signal, null);
|
|
// cat on windows adds a \r\n at the end.
|
|
assert.equal(output.trim(), input.trim());
|
|
});
|
|
}
|
|
|
|
function parent() {
|
|
// should not immediately exit.
|
|
var child = common.spawnCat({ stdio: 'inherit' });
|
|
}
|