mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 06:38:13 +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>
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
'use strict';
|
|
// Testing to send an handle twice to the parent process.
|
|
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var cluster = require('cluster');
|
|
var net = require('net');
|
|
|
|
var workers = {
|
|
toStart: 1
|
|
};
|
|
|
|
if (cluster.isMaster) {
|
|
for (var i = 0; i < workers.toStart; ++i) {
|
|
var worker = cluster.fork();
|
|
worker.on('exit', function(code, signal) {
|
|
assert.equal(code, 0, 'Worker exited with an error code');
|
|
assert(!signal, 'Worker exited by a signal');
|
|
});
|
|
}
|
|
} else {
|
|
var server = net.createServer(function(socket) {
|
|
process.send('send-handle-1', socket);
|
|
process.send('send-handle-2', socket);
|
|
});
|
|
|
|
server.listen(common.PORT, function() {
|
|
var client = net.connect({ host: 'localhost', port: common.PORT });
|
|
client.on('close', function() { cluster.worker.disconnect(); });
|
|
setTimeout(function() { client.end(); }, 50);
|
|
}).on('error', function(e) {
|
|
console.error(e);
|
|
assert(false, 'server.listen failed');
|
|
cluster.worker.disconnect();
|
|
});
|
|
}
|