0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/test/parallel/test-stdio-closed.js
Sakthipriyan Vairamani 69298d36cf test: formatting skip messages for TAP parsing
This patch makes the skip messages consistent so that the TAP plugin
in CI can parse the messages properly. The format will be

    1..0 # Skipped: [Actual reason why the test is skipped]

PR-URL: https://github.com/nodejs/io.js/pull/2109
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-07-20 15:46:30 +05:30

27 lines
701 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
if (process.platform === 'win32') {
console.log('1..0 # Skipped: platform not supported.');
return;
}
if (process.argv[2] === 'child') {
process.stdout.write('stdout', function() {
process.stderr.write('stderr', function() {
process.exit(42);
});
});
return;
}
// Run the script in a shell but close stdout and stderr.
var cmd = '"' + process.execPath + '" "' + __filename + '" child 1>&- 2>&-';
var proc = spawn('/bin/sh', ['-c', cmd], { stdio: 'inherit' });
proc.on('exit', common.mustCall(function(exitCode) {
assert.equal(exitCode, 42);
}));