From 38017905d6d3d10169263ef572ed2119542a63bf Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 19 Mar 2017 14:36:09 -0700 Subject: [PATCH] test: add test for child_process.execFile() While `child_process.execFile()` gets called in places in the test suite, there are no explicit test for it and there are parts of the implementation that are not covered by tests. This adds a minimal test that increases (but does not complete) coverage for the implementation. PR-URL: https://github.com/nodejs/node/pull/11929 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Yuta Hiroto --- test/parallel/test-child-process-execfile.js | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/parallel/test-child-process-execfile.js diff --git a/test/parallel/test-child-process-execfile.js b/test/parallel/test-child-process-execfile.js new file mode 100644 index 0000000000..ab36aa7b15 --- /dev/null +++ b/test/parallel/test-child-process-execfile.js @@ -0,0 +1,21 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const execFile = require('child_process').execFile; +const path = require('path'); + +const fixture = path.join(common.fixturesDir, 'exit.js'); + +{ + execFile( + process.execPath, + [fixture, 42], + common.mustCall((e) => { + // Check that arguments are included in message + assert.strictEqual(e.message.trim(), + `Command failed: ${process.execPath} ${fixture} 42`); + assert.strictEqual(e.code, 42); + }) + ); +}