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

var errors = 0;

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

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.deepStrictEqual(err.spawnargs, spawnargs);
  errors++;
});

process.on('exit', function() {
  assert.equal(1, errors);
});