Skip to content

Commit

Permalink
test: add test for child_process.execFile()
Browse files Browse the repository at this point in the history
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: nodejs/node#11929
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
  • Loading branch information
Trott authored and andrew749 committed Jul 19, 2017
1 parent 4882f9a commit 4c7bf9b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/parallel/test-child-process-execfile.js
Original file line number Diff line number Diff line change
@@ -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);
})
);
}

0 comments on commit 4c7bf9b

Please sign in to comment.