Skip to content
Prev Previous commit
Next Next commit
child_process: refactored test as per the comments + alignment fix
  • Loading branch information
shobhitchittora committed Aug 29, 2018
commit 262c9c1e020f1de7291e8cddd46298106e66a309
4 changes: 2 additions & 2 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ exports.fork = function fork(modulePath /* , args, options */) {
args = arguments[pos++];
}

if (pos < arguments.length && (arguments[pos] === undefined ||
arguments[pos] === null)) {
if (pos < arguments.length &&
(arguments[pos] === undefined || arguments[pos] === null)) {
pos++;
}

Expand Down
12 changes: 6 additions & 6 deletions test/parallel/test-child-process-fork-options.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/**
* fork should parse options correctly if args is undefined or null
*/

'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');

// This test ensures that fork should parse options
// correctly if args is undefined or null
Comment thread
shobhitchittora marked this conversation as resolved.

const assert = require('assert');
const { fork } = require('child_process');
const fixtures = require('../common/fixtures');

const expectedEnv = { foo: 'bar' };
const cp = fork(fixtures.path('child-process-echo-options.js'), undefined,
{ env: Object.assign({}, expectedEnv) });
Comment thread
shobhitchittora marked this conversation as resolved.
Outdated

cp.on('message', common.mustCall(function({ env }) {
cp.on('message', common.mustCall(({ env }) => {
assert.strictEqual(env.foo, expectedEnv.foo);
}));
Comment thread
lundibundi marked this conversation as resolved.
Outdated