0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-child-process-spawn-error.js
Johnny Reading 5be66db688 test: refactor child-process-spawn-error
Use const instead of var for assignments.

PR-URL: https://github.com/nodejs/node/pull/9951
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-12-04 09:49:48 -08:00

18 lines
597 B
JavaScript

'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);
}));