Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/parallel/test-child-process-spawn-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ var assert = require('assert');
var errors = 0;

var enoentPath = 'foo123';
var spawnargs = ['bar'];
assert.equal(common.fileExists(enoentPath), false);

var enoentChild = spawn(enoentPath);
var enoentChild = spawn(enoentPath, spawnargs);
enoentChild.on('error', function (err) {
assert.equal(err.code, 'ENOENT');
assert.equal(err.errno, 'ENOENT');
assert.equal(err.syscall, 'spawn ' + enoentPath);
assert.equal(err.path, enoentPath);
assert.deepEqual(err.spawnargs, spawnargs);
errors++;
});

Expand Down
9 changes: 7 additions & 2 deletions test/parallel/test-child-process-spawnsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ console.log('sleep exited', stop);
assert.strictEqual(stop[0], 1, 'sleep should not take longer or less than 1 second');

// Error test when command does not exist
var ret_err = spawnSync('command_does_not_exist');
assert.strictEqual(ret_err.error.code, 'ENOENT');
var ret_err = spawnSync('command_does_not_exist', ['bar']).error;

assert.strictEqual(ret_err.code, 'ENOENT');
assert.strictEqual(ret_err.errno, 'ENOENT');
assert.strictEqual(ret_err.syscall, 'spawnSync command_does_not_exist');
assert.strictEqual(ret_err.path, 'command_does_not_exist');
assert.deepEqual(ret_err.spawnargs, ['bar']);

// Verify that the cwd option works - GH #7824
(function() {
Expand Down