summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-03-19 14:36:09 -0700
committerJames M Snell <jasnell@gmail.com>2017-03-21 21:31:03 -0700
commit1d82adc8c7ff4a04a9b8ef3fdbbf28515967cdcb (patch)
tree1a740545b0e9f9a8457a1b21c4dcb7bfebee3d43
parent7bc893f0c667528c8f82e79cbff73ac09eafb8a4 (diff)
downloadios-node-v8-1d82adc8c7ff4a04a9b8ef3fdbbf28515967cdcb.tar.gz
ios-node-v8-1d82adc8c7ff4a04a9b8ef3fdbbf28515967cdcb.tar.bz2
ios-node-v8-1d82adc8c7ff4a04a9b8ef3fdbbf28515967cdcb.zip
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 <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
-rw-r--r--test/parallel/test-child-process-execfile.js21
1 files changed, 21 insertions, 0 deletions
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);
+ })
+ );
+}