node/test/sequential/test-child-process-emfile.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

29 lines
703 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var fs = require('fs');
if (process.platform === 'win32') {
console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows');
return;
}
for (;;) {
try {
fs.openSync(__filename, 'r');
} catch (err) {
assert(err.code === 'EMFILE' || err.code === 'ENFILE');
break;
}
}
// Should emit an error, not throw.
var proc = spawn(process.execPath, ['-e', '0']);
proc.on('error', common.mustCall(function(err) {
assert(err.code === 'EMFILE' || err.code === 'ENFILE');
}));
// 'exit' should not be emitted, the process was never spawned.
proc.on('exit', assert.fail);