Skip to content

Commit 55a1126

Browse files
TrottMylesBorins
authored andcommitted
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: #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]>
1 parent 9ba551f commit 55a1126

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const execFile = require('child_process').execFile;
6+
const path = require('path');
7+
8+
const fixture = path.join(common.fixturesDir, 'exit.js');
9+
10+
{
11+
execFile(
12+
process.execPath,
13+
[fixture, 42],
14+
common.mustCall((e) => {
15+
// Check that arguments are included in message
16+
assert.strictEqual(e.message.trim(),
17+
`Command failed: ${process.execPath} ${fixture} 42`);
18+
assert.strictEqual(e.code, 42);
19+
})
20+
);
21+
}

0 commit comments

Comments
 (0)