mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 09:02:40 +00:00

In preparation for a lint rule that will enforce assert.deepStrictEqual() over assert.deepEqual(), change tests and benchmarks accordingly. For tests and benchmarks that are testing or benchmarking assert.deepEqual() itself, apply a comment to ignore the upcoming rule. PR-URL: https://github.com/nodejs/node/pull/6213 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
33 lines
832 B
JavaScript
33 lines
832 B
JavaScript
'use strict';
|
|
var assert = require('assert');
|
|
var common = require('../common');
|
|
var fork = require('child_process').fork;
|
|
var args = ['foo', 'bar'];
|
|
|
|
var n = fork(common.fixturesDir + '/child-process-spawn-node.js', args);
|
|
assert.deepStrictEqual(args, ['foo', 'bar']);
|
|
|
|
var messageCount = 0;
|
|
|
|
n.on('message', function(m) {
|
|
console.log('PARENT got message:', m);
|
|
assert.ok(m.foo);
|
|
messageCount++;
|
|
});
|
|
|
|
// https://github.com/joyent/node/issues/2355 - JSON.stringify(undefined)
|
|
// returns "undefined" but JSON.parse() cannot parse that...
|
|
assert.throws(function() { n.send(undefined); }, TypeError);
|
|
assert.throws(function() { n.send(); }, TypeError);
|
|
|
|
n.send({ hello: 'world' });
|
|
|
|
var childExitCode = -1;
|
|
n.on('exit', function(c) {
|
|
childExitCode = c;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(childExitCode == 0);
|
|
});
|