Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2017-03-04 13:54:48 +0300
committerItalo A. Casas <me@italoacasas.com>2017-03-20 17:19:16 +0300
commit5f6025ba68c0bb19366dc874369cc58d872c5cee (patch)
tree905f8c7c51c2c5f63048b8e1d43be59b86880748 /test
parent646ee559df99f2f22c3eb0cf05684ed9931f28c6 (diff)
test: fail when child dies in fork-net
Previously when the child dies with errors in this test, the parent will just hang and timeout, the errors in the child would be swallowed. This makes it fail so at least there is more information about why this test fails. Also removes the unnecessary child.kill() call. PR-URL: https://github.com/nodejs/node/pull/11684 Ref: https://github.com/nodejs/node/pull/11667 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-child-process-fork-net.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js
index 157704a9ccf..8b8cc44bd41 100644
--- a/test/parallel/test-child-process-fork-net.js
+++ b/test/parallel/test-child-process-fork-net.js
@@ -1,5 +1,5 @@
'use strict';
-require('../common');
+const common = require('../common');
const assert = require('assert');
const fork = require('child_process').fork;
const net = require('net');
@@ -60,9 +60,10 @@ if (process.argv[2] === 'child') {
const child = fork(process.argv[1], ['child']);
- child.on('exit', function() {
- console.log('CHILD: died');
- });
+ child.on('exit', common.mustCall(function(code, signal) {
+ const message = `CHILD: died with ${code}, ${signal}`;
+ assert.strictEqual(code, 0, message);
+ }));
// send net.Server to child and test by connecting
const testServer = function(callback) {
@@ -171,7 +172,6 @@ if (process.argv[2] === 'child') {
testSocket(function() {
socketSuccess = true;
- child.kill();
});
});