Name: childprocess
Owner: node_modules
Description: Wrap `child_process` module to support Multiple Process Code Coverage with istanbul.
Created: 2015-08-30 02:57:23.0
Updated: 2018-03-11 14:59:33.0
Pushed: 2016-07-18 13:57:02.0
Homepage: null
Size: 23
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Inject script into multiple process when using child_process.fork
.
One of the use case is Multiple Process Code Coverage with istanbul.
m i childprocess
ire('childprocess').inject(function(modulePath, args, opt) {
nst execFile = 'path/to/istanbul';
nst cwd = opt.cwd && process.cwd();
nst execArgs = [
'cover',
'--root', cwd,
'--dir', path.join(cwd, './coverage'),
'--report', 'none',
'--print', 'none',
'--include-pid',
modulePath,
'--',
concat(args);
turn [execFile, execArgs, opt];
ire('child_process').fork();
Inject script when using child_process.fork
.
The inject script is a function that running in sandbox in every process. that mean you can't use the variable out of the function.
The function should return an array that contains 3 arguments same as fork.
dprocess.inject(function(modulePath, args, opt) {
turn [modulePath, args, opt];
Use child_process.fork
without injected script.