{"name":"coffee","version":"3.3.3","description":"Test command line on nodejs","main":"index.js","dependencies":{"childprocess":"^2.0.2","debug":"^2.6.8"},"devDependencies":{"autod":"^2.8.0","egg-ci":"^1.6.0","eslint":"^3.19.0","eslint-config-egg":"^4.1.0","istanbul":"0","mm":"^2.1.0","mocha":"2","spy":"^1.0.0"},"repository":{"type":"git","url":"git://github.com/popomore/coffee.git"},"homepage":"https://github.com/popomore/coffee","author":{"name":"popomore","email":"sakura9515@gmail.com"},"keywords":["test","shell","spawn","fork","child_process","exec"],"license":"MIT","engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6, 8"},"scripts":{"lint":"eslint index.js lib test","test":"mocha -R spec -t 80000","cover":"rm -rf coverage && istanbul cover --report none --print none node_modules/mocha/bin/_mocha -- -R spec -t 80000","cov":"npm run cover && istanbul report --root coverage text-summary json lcov","ci":"npm run lint && npm run cov","autod":"autod","clean":"rm -rf coverage"},"publishConfig":{"tag":"latest-3"},"readme":"# Coffee\n\nTest command line on Node.js.\n\n---\n\n[![NPM version](https://img.shields.io/npm/v/coffee.svg?style=flat)](https://npmjs.org/package/coffee)\n[![Build Status](https://img.shields.io/travis/popomore/coffee.svg?style=flat)](https://travis-ci.org/popomore/coffee)\n[![codecov.io](https://img.shields.io/codecov/c/github/popomore/coffee.svg?style=flat)](http://codecov.io/github/popomore/coffee?branch=master)\n[![NPM downloads](http://img.shields.io/npm/dm/coffee.svg?style=flat)](https://npmjs.org/package/coffee)\n\n## Install\n\n```bash\n$ npm i coffee --save\n```\n\n## Usage\n\nCoffee is useful for test command line in test frammework (like Mocha).\n\n```js\ndescribe('cat', function() {\n  it('should concat input', function(done) {\n    var coffee = require('coffee');\n    coffee.spawn('cat')\n    .write('1')\n    .write('2')\n    .expect('stdout', '12')\n    .expect('code', 0)\n    .end(done);\n  })\n})\n```\n\nYou can also use fork for spawning Node processes.\n\n```js\ncoffee.fork('/path/to/file.js', ['args '])\n.expect('stdout', '12\\n')\n.expect('stderr', '34\\n')\n.expect('code', 0)\n.end(done);\n```\n\nIn file.js\n\n```js\nconsole.log(12);\nconsole.error(34);\n```\n\n## Support multiple process coverage with istanbul\n\nCoffee will detect `istanbul` automatically, and generate coverage-{processId}.json, you should generate reporter by `istanbul report`.\n\n```bash\n$ rm -rf coverage\n$ istanbul cover --report none --print none node_modules/mocha/bin/_mocha -- -R spec -t 5000\n$ istanbul report text-summary json lcov\n=============================== Coverage summary ===============================\nState## ments   : 98.2% ( 109/111 )\nBranches     : 97.37% ( 37/38 )\nFunctions    : 100% ( 20/20 )\nLines        : 98.18% ( 108/110 )\n================================================================================\n```\n\n## API\n\n### coffee.spawn\n\nRun command using `child_process.spawn`, then return `Coffee` instance.\n\nArguments see [child_process.spawn](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)\n\n### coffee.fork\n\nRun command using `child_process.fork`, then return `Coffee` instance.\n\nArguments see [child_process.fork](http://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)\n\n### Coffee\n\nAssertion object\n\n#### coffee.expect(type, expected)\n\nAssert type with expected value, expected value can be string, regular expression, and array.\n\n```js\ncoffee.spawn('echo', ['abcdefg'])\n.expect('stdout', 'abcdefg')\n.expect('stdout', /^abc/)\n.expect('stdout', ['abcdefg', /abc/])\n.end(done);\n```\n\nAccept type: `stdout`, `stderr`, `code`, `error`\n\n#### coffee.notExpect(type, expected)\n\nThe opposite assertion of `expect`.\n\n#### coffee.write(data)\n\nWrite data to stdin, see example above.\n\n#### coffee.end(callback)\n\nCallback will be called after completing the assertion, the first argument is Error if throw exception.\n\n#### coffee.debug(level)\n\nWrite data to process.stdout and process.stderr for debug\n\n`level` can be\n\n- 0 (default): pipe stdout + stderr\n- 1: pipe stdout\n- 2: pipe stderr\n- false: disable\n\nAlternative you can use `COFFEE_DEBUG` env.\n\n#### coffee.coverage()\n\nIf you set false, coffee will not generate coverage.json, default: true.\n\n## LISENCE\n\nCopyright (c) 2015 popomore. Licensed under the MIT license.\n\n\n[istanbul]: https://github.com/gotwarlost/istanbul\n","readmeFilename":"README.md","gitHead":"bd5f81e00778166a6e54b66f9eceb7fa755f971a","bugs":{"url":"https://github.com/popomore/coffee/issues"},"_id":"coffee@3.3.3","_npmVersion":"5.6.0","_nodeVersion":"8.11.4","_npmUser":{"name":"atian25","email":"atian25@qq.com"},"dist":{"integrity":"sha512-XjV8yuXKAa7H+DrW9GyTHcOgbhEfi884b1nTuioqAyTX3OiBNsToNFTqXNF6VvL/WNBG8LQZAKyF1uvEQ0jyMA==","shasum":"c457b213256a6f8c92f9410779eac810e8580fa6","tarball":"http://registry-npm.ywwl.com/coffee/download/coffee-3.3.3.tgz","fileCount":10,"unpackedSize":17855,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbrcY9CRA9TVsSAnZWagAAGAgP+wd4FpxvlHLGY9Gtab6k\ndcOqMkWHtNTSw1nHlydDxlvyHxunc+xWEr0ljawRMdokZB/WYVz/7rMNnDcW\nKl5mqFKJtKTguNpqwSh3sCBnR3/Hy4D9Z6Df2+jc25BJteUcW4gDQ+7Q8xy6\niBBH7ILaZ3qSDRuJKPl3+9aMLzr6nikfP42tL1K7yc01C4NZD9ce/kH1G66D\ndqOL4YDUwpbSxwuN5ryw05fo+pmOqZDdS/lb/TXL+yUsvHXBGgpunjqZw/m/\nS1RWyl0ZgDbnCmu4jX/4Wr0/DSgOZm0oTuuOTQahvBAkr3o0ojrn5SQxJVDg\nFJPninJfDNWEzCziXTsRfoqwzdRP5RZOJ/2gyy1isU3/HlTLvSuSpn5RJlgk\nr1NP1cRRqO0E/6Qit8INgWu8LaE7wE1asB/bBX0q+HtrubArMm5GO4tJvN2B\nNqll//WQdF++k0ruoIO4R49luud7doLGy4KA6+Ea5HjEEug+ONVqhRWyobln\nNGPKDiaHp4wRjkge3xkJUiM3FP5+dxRKg7sGpPBZccVRF1YcA1ox/kd8HV2b\nMPCF9iOx7rowPE+Z5DmOC8skKoLQklPIpKnrmn6H1AsWSvcyz0W40HP3UqiM\n6To/Seh2EyTg+FcOet6O4YJfkFg/mefAv4BxDp9ovH4vM9nFUw15eCimsVpH\nDcx4\r\n=CTza\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCv1htoe9E+ujUb8pgAaeg/QR7enSxMKpMu+lWs9Xg7LgIhAL81LT9g1WoQCkMnhV3D7aqJ3ZZGic+tDR9au+bmlfBE"}],"size":5970,"noattachment":false,"key":"/coffee/-/coffee-3.3.3.tgz"},"maintainers":[{"email":"atian25@qq.com","name":"atian25"},{"email":"fengmk2@gmail.com","name":"fengmk2"},{"email":"sakura9515@gmail.com","name":"popomore"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/coffee_3.3.3_1538115133087_0.18087307337486447"},"_hasShrinkwrap":false,"publish_time":1538115133212,"_cnpm_publish_time":1538115133212,"dist-tags":{"latest":"5.5.1","latest-3":"3.3.3","latest-4":"4.2.1"}}