mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 20:46:16 +00:00

Use assert.strictEqual instead of assert.equal in tests, manually convert types where necessary. PR-URL: https://github.com/nodejs/node/pull/10698 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
39 lines
764 B
JavaScript
39 lines
764 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const fork = require('child_process').fork;
|
|
|
|
if (process.argv[2] === 'child') {
|
|
process.send('1');
|
|
|
|
// check that child don't instantly die
|
|
setTimeout(function() {
|
|
process.send('2');
|
|
}, 200);
|
|
|
|
process.on('disconnect', function() {
|
|
process.stdout.write('3');
|
|
});
|
|
|
|
} else {
|
|
const child = fork(__filename, ['child'], {silent: true});
|
|
|
|
const ipc = [];
|
|
let stdout = '';
|
|
|
|
child.on('message', function(msg) {
|
|
ipc.push(msg);
|
|
|
|
if (msg === '2') child.disconnect();
|
|
});
|
|
|
|
child.stdout.on('data', function(chunk) {
|
|
stdout += chunk;
|
|
});
|
|
|
|
child.once('exit', function() {
|
|
assert.deepStrictEqual(ipc, ['1', '2']);
|
|
assert.strictEqual(stdout, '3');
|
|
});
|
|
}
|