{"name":"childprocess","version":"2.0.2","description":"Wrap `child_process` module to support Multiple Process Code Coverage with istanbul.","main":"index.js","files":["index.js"],"scripts":{"cover":"istanbul cover --include-all-sources --report none --print none node_modules/mocha/bin/_mocha -- --check-leaks -t 50000 test/*.test.js","lint":"eslint index.js fixtures test","test":"npm run clean && npm run lint && npm run cover && istanbul report --root coverage json lcov html text","autod":"autod -w --prefix '~'","clean":"rm -rf coverage"},"dependencies":{"utility":"~1.6.0"},"devDependencies":{"autod":"*","coffee":"1","eslint":"1","istanbul":"*","mm":"1","mocha":"*","pedding":"1","spy":"~0.1.3"},"homepage":"https://github.com/node-modules/childprocess","repository":{"type":"git","url":"git://github.com/node-modules/childprocess.git","web":"https://github.com/node-modules/childprocess"},"bugs":{"url":"https://github.com/node-modules/childprocess/issues","email":"m@fengmk2.com"},"keywords":["childprocess","child_process","multiple_process","istanbul","coverage","cov","codecov"],"engines":{"node":">=0.12.0"},"author":{"name":"fengmk2","email":"m@fengmk2.com","url":"http://fengmk2.com"},"license":"MIT","contributors":[{"name":"fengmk2","email":"m@fengmk2.com","url":"https://fengmk2.com"}],"gitHead":"caed1ee042849f4aeb3b41f68b5186fe8b3a4cdc","_id":"childprocess@2.0.2","_shasum":"3d684929748b1e13e8521cf619bde5440de85eb4","_from":".","_npmVersion":"2.15.5","_nodeVersion":"4.4.5","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"dist":{"shasum":"3d684929748b1e13e8521cf619bde5440de85eb4","tarball":"http://registry-npm.ywwl.com/childprocess/download/childprocess-2.0.2.tgz","integrity":"sha512-ONqPBsbg+0c+s3p7HfOVm4zN3MnkfsDelUC8geQ1uH796Z4A/ArGLAaSp2HPRa+0qDPCJLz1Tw0d0vRa0ZITuw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGAHMirFoVureRb+Ty0p7gak9MzOqA3v8eOHwO3kpp+oAiEA785NCpoEGM1o6gQHtoC6dHpXPOuybgYfIwsIpoAiVSY="}],"size":3497,"noattachment":false,"key":"/childprocess/-/childprocess-2.0.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/childprocess-2.0.2.tgz_1466432913360_0.9550363379530609"},"directories":{},"readme":"childprocess\n=======\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![appveyor build status][appveyor-image]][appveyor-url]\n[![Test coverage][cov-image]][cov-url]\n[![David deps][david-image]][david-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/childprocess.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/childprocess\n[travis-image]: https://img.shields.io/travis/node-modules/childprocess.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/childprocess\n[appveyor-image]: https://ci.appveyor.com/api/projects/status/aeh1v06b88nb7ok9?svg=true\n[appveyor-url]: https://ci.appveyor.com/project/fengmk2/childprocess\n[cov-image]: https://codecov.io/github/node-modules/childprocess/coverage.svg?branch=master\n[cov-url]: https://codecov.io/github/node-modules/childprocess?branch=master\n[david-image]: https://img.shields.io/david/node-modules/childprocess.svg?style=flat-square\n[david-url]: https://david-dm.org/node-modules/childprocess\n[download-image]: https://img.shields.io/npm/dm/childprocess.svg?style=flat-square\n[download-url]: https://npmjs.org/package/childprocess\n\nInject script into multiple process when using `child_process.fork`.\n\nOne of the use case is [Multiple Process Code Coverage](https://github.com/gotwarlost/istanbul#multiple-process-usage) with [istanbul].\n\n- [cluster code coverage with istanbul](http://fengmk2.com/blog/2015/cluster-coverage/README.html)\n\n## Install\n\n```bash\n$ npm i childprocess\n```\n\n## Usage\n\n```js\nrequire('childprocess').inject(function(modulePath, args, opt) {\n  const execFile = 'path/to/istanbul';\n  const cwd = opt.cwd && process.cwd();\n  const execArgs = [\n    'cover',\n    '--root', cwd,\n    '--dir', path.join(cwd, './coverage'),\n    '--report', 'none',\n    '--print', 'none',\n    '--include-pid',\n    modulePath,\n    '--',\n  ].concat(args);\n  return [execFile, execArgs, opt];\n});\nrequire('child_process').fork();\n```\n\n## APIs\n\n## inject(cb) / inject(filepath)\n\nInject script when using `child_process.fork`.\n\nThe inject script is a function that running in sandbox in every process. that mean you can't use the variable out of the function.\n\nThe function should return an array that contains 3 arguments same as fork.\n\n```js\nchildprocess.inject(function(modulePath, args, opt) {\n  return [modulePath, args, opt];\n});\n```\n\n### reset()\n\nUse `child_process.fork` without injected script.\n\n## License\n\n[MIT](LICENSE)\n\n[istanbul]: https://github.com/gotwarlost/istanbul\n","publish_time":1466432915510,"_cnpm_publish_time":1466432915510,"dist-tags":{"latest":"2.0.2"}}