summaryrefslogtreecommitdiff
path: root/test/parallel/test-child-process-spawn-error.js
blob: 6cd3c47eef46ad253c248a2b8156147f83960d59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const common = require('../common');
const spawn = require('child_process').spawn;
const assert = require('assert');

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

const enoentChild = spawn(enoentPath, spawnargs);
enoentChild.on('error', common.mustCall(function(err) {
  assert.strictEqual(err.code, 'ENOENT');
  assert.strictEqual(err.errno, 'ENOENT');
  assert.strictEqual(err.syscall, 'spawn ' + enoentPath);
  assert.strictEqual(err.path, enoentPath);
  assert.deepStrictEqual(err.spawnargs, spawnargs);
}));