{"_id":"@amilajack/joker","_rev":"11-4ef975226441b74cc87a1e3b5f6bd0c3","name":"@amilajack/joker","dist-tags":{"latest":"0.0.4","next":"0.0.3-3"},"versions":{"0.0.0":{"name":"@amilajack/joker","version":"0.0.0","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint .","test":"yarn build && jest --runInBand && yarn docs","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.2.2","@babel/plugin-proposal-class-properties":"^7.3.0","@babel/preset-env":"^7.3.1","@babel/preset-typescript":"^7.1.0","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/jest":"^23.3.13","@types/node":"^10.12.18","cross-env":"^5.2.0","eslint":"^5.12.1","eslint-config-bliss":"^3.2.0","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.0.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.2.4"},"dependencies":{"assertion-error":"~1.1.0","clone":"^2.1.2","shell-quote":"^1.6.1"},"types":"./dist/index.d.ts","eslintConfig":{"extends":"bliss"},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"gitHead":"67b8396bed90a52fc487195cf06efeaa98ce89b1","bugs":{"url":"https://github.com/amilajack/joker/issues"},"_id":"@amilajack/joker@0.0.0","_nodeVersion":"11.10.0","_npmVersion":"6.9.0-next.0","dist":{"integrity":"sha512-FaS1nJ842hyMD2UtLCXfQLZ8ThWI452DZJ6sHiqYmeexHwX9RoYepJGfHLJ5bQyWg+C771YrK+cO7JVwDpbmSQ==","shasum":"98321ead72ead196ed5d6aaadf05c6e97ef78408","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.0.tgz","fileCount":71,"unpackedSize":2032457,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcb4shCRA9TVsSAnZWagAANeQQAIMIIP49USLFOVEOyXlt\nrA4UTtv1oeIT3Q0PBRcB4XQsFPjLeO8WxLtSdOeJNxL5OBbLwwqfuYcqqUNh\nkbgNi4khPJOtkqMwsLEaf5sIf0f9dpL2RtR2qLp0N+VBeHO/JaMguedx7lcc\n1/t+jgDoy8G3kK24+nsnGv+QS46hCB+jUZM1LsiVX7GegqjMvc4xWfDs9NDA\n3bYKwarmvIjvzWxPwv6cPQJU0IV1rEixqxjXoOAeCOHDzPClKk/R7DDUJZrP\ncGDc9RyxCxXxAifnyXsUHLAr4INDamLjnuNDibNCe8a0HHWo4swvelBVzwa9\nPQCzwsnvcVCOsaiweI435qNaCIPdZmDtH1FI1WysPENre0E7pmvhxpuqw79p\nsv8bGKbNo1U18bd5FKF92uEKS5J7aAwCUrc5qaiycPa/s+i3dKgWLoMqXoYD\na6rrpUm36LO+p0nyBKDLIJleUr1ONlD7Q809VoF2vjhc8QGhYBAXVRNasaUR\ntb/fXUewrvUY6sSwJZhtJWGPwvR2cIBCwDXFH7j3g5hFBRJ+y0nt0akHQ7W8\nAzciur42TST03mzPoOsQyseEkGrcOjKkgrGZLmtXX91CThjtBUBlMXUIn58U\nd/UQurVi2ZYR1WIhKeUYR1kKWtEC67tJVTNA/rw7KYt7g0hRelINqtSns4C2\nCI5H\r\n=ZUgw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFEUFpObIN4Ku4dA++vJRGsIeHNrBOhqewFyO917K/6TAiEA9yPWLG/rTHOLaHFYbqK4BA9Uod8vCrPUEkejc1LSR6M="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.0_1550813984454_0.7128932724380961"},"_hasShrinkwrap":false},"0.0.1-0":{"name":"@amilajack/joker","version":"0.0.1-0","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint .","test":"yarn build && jest --runInBand && yarn docs","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.2.2","@babel/plugin-proposal-class-properties":"^7.3.0","@babel/preset-env":"^7.3.1","@babel/preset-typescript":"^7.1.0","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/jest":"^23.3.13","@types/node":"^10.12.18","cross-env":"^5.2.0","eslint":"^5.12.1","eslint-config-bliss":"^3.2.0","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.0.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.2.4"},"dependencies":{"assertion-error":"~1.1.0","clone":"^2.1.2","shell-quote":"^1.6.1"},"types":"./dist/index.d.ts","eslintConfig":{"extends":"bliss"},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"readmeFilename":"README.md","readme":"> ## 🛠 Status: In Development\n> Joker is currently in development. It's on the fast track to a 1.0 release, so we encourage you to use it and give us your feedback, but there are things that haven't been finalized yet and you can expect some changes.\n\n[![Build Status](https://travis-ci.com/amilajack/joker.svg)](http://travis-ci.com/amilajack/joker)\n\nAn modern and intuitive testing for command-line apps.\n\n## Installation\n\n```bash\n$ npm install @amilajack/joker\n```\n\n### How it looks\n\n```js\nimport Joker from '@amilajack/joker';\n\nnew Joker()\n  .exec('touch /tmp/test')\n  .run('ls /tmp/')\n  .stdout(/test/)\n  .end();\n```\n\n### Formatting options\n\njoker can strip newlines and colors. You can tell it to do so by passing an\nobject that looks like this:\n\n```js\nconst options = {\n  colors: false,\n  newLines: false,\n};\n\nJoker(options).stdout...\n```\n\n### Custom expectations\n\nWhile joker comes with built-in expectations, you can use your own too.\n\n```js\nnew Joker()\n  .expect((result) => {\n    if (result.stdout !== 'unicorns') {\n      return new Error('NO!');\n    }\n  })\n  .run('unicorns')\n  .end(fn);\n```\n\n### Custom middlewares\n\nYou can register as many before and after middlewares as you wish.\n\n```js\nnew Joker()\n  .before(setupDatabase)\n  .before(runMigrations)\n  .run(cmd)\n  .after(downgradeCron)\n  .after(deleteDatabase)\n  .end();\n```\n\n### Middleware order\n\nThe Middleware execution order is very simple - \"before\" middlewares always run\nbefore everything else, \"after\" middlewares always run after everything else.\nThe other middlewares will match the order that you have specified.\n\n```js\nnew Joker()\n  .before(before1)\n  .before(before2)\n  .after(after1)\n  .after(after2)\n  .writeFile(file, '')\n  .run(cmd)\n  .unlink(file)\n  .end(fn);\n\n// Execution order:\n// before1, before2, writeFile, cmd, unlink, after1, after2\n```\n\nYou may also want to reuse before and after middlewares as much as possible,\nespecially when testing something that requires extensive setup and cleanup. You\ncan accomplish this by cloning a joker instance.\n\n```js\nconst base = new Joker()\n  .before(setupDatabase)\n  .after(removeDatabase);\n\n// Later on\n\nbase.clone().run....\n```\n\n### Plugins\n\njoker has primitive support for plugins. You can register any expectation or/and\nany middleware by calling `joker.register`.\n\n```js\nconst fn = () => {};\nnew Joker().register('foo', fn);\n```\n\nOr you may want to register many functions at once.\n\n```js\nconst fn = () => {};\nconst fn1 = () => {};\njoker.register({ baz: fn, bar: fn1 });\n```\n\n### Usage with a test runner\n\njoker plays nice with any test runner out there. Here is a minimal example how\nyou could use it with Mocha.\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', (done) => {\n    new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end(done);\n  });\n});\n```\n\n### Usage without a test runner\n\nWhile using a test runner is recommended joker is completely 'nodeable'. Here is\na simple example how you could accomplish that:\n\n```js\nconst assert = require('assert');\n\nfunction refute(err) {\n  assert(!err);\n}\n\nnew Joker()\n  .run(cmd)\n  .end(refute);\n\nnew Joker()\n  .run(anotherCmd)\n  .end(refute);\n```\n\n### Responding to interactive prompts\n\njoker can respond to apps that run interactively using the `on()` and\n`respond()` functions.\n\n```js\nnew Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\nSee `test/prompt.test.js` for more examples.\n\n## API\n\n### #before\n\nRegister a \"before\" middleware.\n\n```js\nnew Joker()\n  .before(fn)\n  .before(fn2)\n  .run(cmd)\n  .end();\n```\n\n### #after\n\nRegister an \"after\" middleware.\n\n```js\nnew Joker()\n  .run(cmd)\n  .after(fn)\n  .after(fn2)\n  .end();\n```\n\n### #cwd\n\nChange the current working directory of the main command (specified with `run`).\nPlease note that this won't affect any other commands like `unlink` etc.\n\n```js\nnew Joker()\n  .cwd(__dirname)\n  .run('pwd')\n  .stdout(/test$/)\n  .end();\n```\n\n### #base\n\nSet a base command. Useful for templates.\n\n```js\nnew Joker()\n  .base('node ')\n  .run('--version')\n  .stdout('0.10.16')\n  .end();\n```\n\n### #run\n\nSet a primary command to execute:\n\n```js\nnew Joker()\n  .run('node --version')\n  .stdout('0.10.16')\n  .end(fn);\n```\n\nYou could also run the test right after specifying the command to run:\n\n```js\nnew Joker()\n  .stdout('0.10.16')\n  .run('node --version', fn);\n```\n\n### #stdin\n\nSet the contents of stdin.\n\n```js\nnew Joker()\n  .stdin('foobar')\n  .run('rev')\n  .stdout('raboof')\n  .end(fn);\n```\n\n### #env\n\nSet environment variables.\n\n```js\nnew Joker()\n  .env('foo', 'bar')\n  .env('baz', 'boo')\n  .run('node --version')\n  .stdout('0.10.16')\n  .end(fn);\n```\n\n### #timeout\n\nSet a timeout for the main command that you are about to test.\n\n```js\nnew Joker()\n  .timeout(1) // ms\n  .run('cat /dev/null')\n  .end(fn);\n```\n\n### #stdout\n\nSet expectations on stdout.\n\n```js\nnew Joker()\n  .stdout('LICENSE Makefile')\n  .run('ls')\n  .end(fn);\n```\n\nWorks with regular expressions too.\n\n```js\nnew Joker()\n  .stdout(/system/)\n  .run('time')\n  .end(fn);\n```\n\n### #stderr\n\nSame as `stdout` but well.. surprise works with stderr.\n\n```js\nnew Joker()\n  .run('todo add')\n  .stderr('Please speicfy a todo')\n  .end(fn);\n```\n\n### #code\n\nExpect a given exit code.\n\n```js\nnew Joker()\n  .run('todo add')\n  .code(1)\n  .end(fn);\n```\n\n### #exist\n\nCheck if a given path exists (works with both files and directories).\n\n```js\nnew Joker()\n  .run('mkdir /tmp/test')\n  .exist('/tmp/test')\n  .end(fn);\n```\n\n### #match\n\nCheck the contents of a file.\n\n```js\nnew Joker()\n  .writeFile(file, 'Hello')\n  .run('node void.js')\n  .match(file, 'Hello')\n  .unlink(file)\n  .end(done);\n```\n\n```js\nnew Joker()\n  .writeFile(file, 'Hello')\n  .run('node void.js')\n  .match(file, /ello/)\n  .unlink(file)\n  .end(done);\n```\n\n### #mkdir\n\nCreate a new directory.\n\n```js\nnew Joker()\n  .mkdir('xml-database')\n  .run('this does stuff with the xml-database directory')\n  .end(fn);\n```\n\n### #exec\n\nExecute a given command.\n\n```js\nnew Joker()\n  .writeFile('LICENSE', 'MIT License')\n  .exec('git add -a')\n  .exec('git commit -m \"Add LICENSE\"')\n  .run('git log')\n  .stdout(/LICENSE/)\n  .end();\n```\n\nBy default the commands will inherit the \"world\" for the main command which\nincludes environment variables, cwd, timeout. However, you can override this by\nsupplying a different \"world\":\n\n```js\nnew Joker()\n  .exec('git add LICENSE', { timeout: 4, cwd: '/tmp' })\n  .run('git log')\n  .stdout(/LICENSE/)\n  .end();\n```\n\n### #writeFile\n\nCreate a file with or without given contents.\n\nWithout:\n\n```js\nnew Joker()\n  .writeFile(pathToFile)\n  .end();\n```\n\nWith:\n\n```js\nnew Joker()\n  .writeFile(pathToFile, data)\n  .end();\n```\n\n### #rmdir\n\nRemove a directory.\n\n```js\nnew Joker()\n  .mkdir('xml-database')\n  .run('this does stuff with the xml-database directory')\n  .rmdir('xml-database')\n  .end(fn);\n```\n\n### #unlink\n\nUnlink a file.\n\n```js\nnew Joker()\n  .writeFile('my-file', data)\n  .run('this does stuff with my file')\n  .unlink('my-file')\n  .end(fn);\n```\n\n### #on\n\nDetect a prompt for user input. Accepts a String or RegExp that appears in\nthe the stdout stream. Must be paired with #respond.\n\n```js\nnew Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\n### #respond\n\nWrite a response to the stdin stream when a prompt is detected.\n\nSee #on\n\n### #end\n\nRun the given test.\n\n```js\nnew Joker()\n  .run('ls')\n  .stdout('this-is-not-porn-i-promise')\n  .end((err) => {});\n```\n\nThe same might be accomplished with supplying a function to `run`:\n\n```js\nnew Joker()\n  .stdout('this-is-not-porn-i-promise')\n  .run('ls', (err) => {});\n```\n\n### #clone\n\nDeep clone a joker instance.\n\n```js\nconst clone = new Joker()\n  .before(fn)\n  .after(fn)\n  .run('my awesome command')\n  .end()\n  .clone();\n```\n\n### #expect\n\nRegister a custom expectation.\n\n```js\nnew Joker()\n  .expect((result) => {\n    if (result.stdout !== 'Unicorns') {\n      return new Error('OMG');\n    }\n  })\n  .run('ls')\n  .end(fn);\n```\n\n## Credits\n\nSpecial thanks to:\n\n- [Alexander Petkov](https://dribbble.com/apetkov) - logo design\n- [Martin Lazarov](https://github.com/mlazarov) - various ideas\n- [Radoslav Stankov](https://github.com/rstankov)\n\n## Support the author\n\nDo you like this project? Star the repository, spread the word - it really helps. You may want to follow\nme on [Twitter](https://twitter.com/amilajack) and\n[GitHub](https://github.com/amilajack). Thanks!\n","licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.1-0","dist":{"shasum":"0e0b9b51a16dae6dab59be0ecf4e630028139ecd","integrity":"sha512-A30WI95fsf21mT8/m2xaSoyUygGM3c6+Fhxp9YX8QvU/ZeHoayphH5eJGUh3wNu9+r828DefBE2TbJ1swblN3A==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.1-0.tgz","fileCount":16,"unpackedSize":98698,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcb4w4CRA9TVsSAnZWagAAh4AP/0iZ2thIeEcfXLSz99ua\nSlEE+9MalQijiCHw6JQsnXJBmd3nnTyUvmp7Ww5jpAadbY2saUpubbXADqnb\nwERy76v0vypRzb/7tGOylogwYxbqqLtUVB96wZ3TeDmAk4R4SR0RmZJNVzvv\nJ5jIg7ijoDgaVarr+40OTuCjSSBr92ELABwdpAxAEOlghBpnbAVehyjnB89/\nGTQBZZLA60KolZQtwZ5C9YVwOnLM7EgSHOdfZM7oQgegjp/Wg/3Pt5ANdpjg\n1lwenBR61SwVmNqNO0MDCEjIQJWQEFjYx4wZ/LlY2B+NMYoEDnBBy7kbyHaV\nU9mL2Vzbb95IeaJG2TnBdSlNTCWRgUoL8MMi5Tab/5QZFycNj3zUmqyKjKQz\nblKUI/8d2WDB4DnoS1VQ9eCeioqn05mAJ60XHZQsIu4WL8vVTWsPpjduil3c\ndtSDP45Av2zf1hVG8IfJeU9cpUh+aAy3R6iF3ndDX03KlTSnH0ZMVvXW3CXv\nQmFHxRNEs7/BsvMirwjY935sUoQugbMj5dNqbZ4e/3TAd+q3jSuvZSrFbEq4\nK4z0dmMNtuhMStDLmvXbhtng99Z0jpQ5hID9ovm/AmUULM1Wlb00Fv3jFhm1\nOCSEH1ZRzZRiiQz24eZjHtyAO+QaaKKvv6o/AnBNUXxH3AkXmjuPnBYsp23N\najXW\r\n=THYP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEUux60kTj3WbcSOtncGuu79RIJeHflaNf7/l/xPVCpAIgLuOYkft5RCjDiiuP2tqaB/sPYYO7VvggzOGoHEPtpIc="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.1-0_1550814263902_0.4723518696721236"},"_hasShrinkwrap":false},"0.0.1-1":{"name":"@amilajack/joker","version":"0.0.1-1","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ignore-path .gitignore --ignore-pattern '/docs/' --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec && yarn docs","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.3","@babel/plugin-proposal-class-properties":"^7.3.3","@babel/preset-env":"^7.3.1","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.6","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.1","@typescript-eslint/parser":"^1.4.1","assertion-error":"^1.1.0","babel-jest":"^24.1.0","cross-env":"^5.2.0","eslint":"^5.14.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"types":"./dist/index.d.ts","eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"readmeFilename":"README.md","readme":"> ## 🛠 Status: In Development\n> Joker is currently in development. It's on the fast track to a 1.0 release, so we encourage you to use it and give us your feedback, but there are things that haven't been finalized yet and you can expect some changes.\n\n[![Build Status](https://dev.azure.com/amilajack/amilajack/_apis/build/status/amilajack.joker?branchName=master)](https://dev.azure.com/amilajack/amilajack/_build/latest?definitionId=1&branchName=master)\n\nA modern and intuitive testing library for command-line apps\n\n## Installation\n\n```bash\n$ npm install --save @amilajack/joker\n```\n\n## How it looks\n\n```js\nimport Joker from '@amilajack/joker';\n\nawait new Joker()\n  .cwd(path.join(__dirname, 'fixtures'))\n  .env('NODE_ENV', 'production')\n  .before('touch /tmp/test')\n  .run('ls /tmp/')\n  .stdout(/test/)\n  .code(0)\n  .end();\n```\n\n## API\n\nSee [full API docs](https://amilajack.github.io/joker/classes/runner)\n\n## Features\n\n### Formatting options\n\nJoker can strip newlines and colors. You can tell it to do so by passing an\nobject that looks like this:\n\n```js\nconst options = {\n  colors: true,\n  newLines: true,\n};\n\nnew Joker(options)\n```\n\n### Custom expectations\n\nWhile Joker comes with built-in expectations, you can use your own too.\n\n```js\nawait new Joker()\n  .expect((result) => {\n    if (result.stdout !== 'unicorns') {\n      return new Error('NO!');\n    }\n  })\n  .run('unicorns')\n  .end();\n```\n\n### Custom middlewares\n\nYou can register as many before and after middlewares as you wish.\n\n```js\nawait new Joker()\n  .before(setupDatabase)\n  .before(runMigrations)\n  .run(cmd)\n  .after(downgradeCron)\n  .after(deleteDatabase)\n  .end();\n```\n\n### Middleware order\n\nThe Middleware execution order is very simple - \"before\" middlewares always run\nbefore everything else, \"after\" middlewares always run after everything else.\nThe other middlewares will match the order that you have specified.\n\n```js\nawait new Joker()\n  .before(before1)\n  .before(before2)\n  .after(after1)\n  .after(after2)\n  .writeFile(file, '')\n  .run(cmd)\n  .unlink(file)\n  .end();\n\n// Execution order:\n// before1, before2, writeFile, cmd, unlink, after1, after2\n```\n\nYou may also want to reuse before and after middlewares as much as possible,\nespecially when testing something that requires extensive setup and cleanup. You\ncan accomplish this by cloning a Joker instance.\n\n```js\nconst base = new Joker()\n  .before(setupDatabase)\n  .after(removeDatabase);\n\n// Later on\n\nbase.clone().run....\n```\n\n### Plugins\n\nJoker has primitive support for plugins. You can register any expectation or/and\nany middleware by calling `joker.register`.\n\n```js\nconst fn = () => {};\nnew Joker().register('foo', fn);\n```\n\nOr you may want to register many functions at once.\n\n```js\nconst fn = () => {};\nconst fn1 = () => {};\njoker.register({ baz: fn, bar: fn1 });\n```\n\n### Usage with a test runner\n\nJoker plays nice with any test runner out there. Here is a minimal example how\nyou could use it with Mocha.\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', (done) => {\n    new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end(done);\n  });\n});\n```\n\n### Usage without a test runner\n\nWhile using a test runner is recommended Joker is completely 'nodeable'. Here is\na simple example how you could accomplish that:\n\n```js\nconst assert = require('assert');\n\nfunction refute(err) {\n  assert(!err);\n}\n\nnew Joker()\n  .run(cmd)\n  .end(refute);\n\nnew Joker()\n  .run(anotherCmd)\n  .end(refute);\n```\n\n### Responding to interactive prompts\n\nJoker can respond to apps that run interactively using the `on()` and\n`respond()` functions.\n\n```js\nawait new Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\nSee [`test/prompt.test.ts`](https://github.com/amilajack/joker/blob/master/tests/prompt.test.ts) for more examples.\n\n## Credits\n\nSpecial thanks to:\n\n- [Martin Lazarov](https://github.com/mlazarov)\n- [Radoslav Stankov](https://github.com/rstankov)\n\n## Support the author\n\nDo you like this project? Star the repository, spread the word - it really helps. You may want to follow\nme on [Twitter](https://twitter.com/amilajack) and\n[GitHub](https://github.com/amilajack). Thanks!\n","licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.1-1","dist":{"shasum":"7ea8f8cd337d1f1c9d39c8c1d886e82e685adc4f","integrity":"sha512-fgSZMLc50Bscd37+1BHkuj0+y6duBy69NwrnD/S7xJCtrmW89R4oIlRcpr+JUlNUm8YVqntm/juSI5Zn/R/4fA==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.1-1.tgz","fileCount":17,"unpackedSize":118241,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJccd3XCRA9TVsSAnZWagAAzR4P/1SiscgW2mxM65EJ8aFW\n65LTHNfrWQS1in9xVRyZ0VhN3jG4oi55P4SfRuW5+tiduLH+RFcsCw0S4Ww8\n6xpyIwFOA0nZ+ojl7h22FxcffM2XtH+ePF/4KtLtMeE3Fy1v1gSehen8iJs2\n68VvDlv5CRarDIv75ClzpphWozqc24/P3qpuFpJ/Dmkpfn6SkMP5gvCX+NfT\n7sTGaZtz0CEbMPPuh/yxx4+Nh7qHAoCrKXADp/aeFz+5rUZ5ELb9VcGcmsn8\n8h/Wi4UqcVEHs1XkTk8yeh28131uTIE005GpO0KN0Bt8Bgls5x2qKlIqVrv4\nIU+J1d21gVoAtkmEb07Y4cOqaN/agMopj+ITpqWU0fM1fWapyaL/f0mwUdbv\nxESIOUkqjokxp/hgrsr5spEpn9DgtFD7yC6ocmLgwxsJRXkt2I7n96gFvgvw\nqqkcyRhBw8O3SkmL6hsOB5KKxpeXNK6UsBTBPlHM1f0J7EInS1seytDF3GF1\nCFVWm/ww14G9sK6SpzaUxlJfD0Ca5h/BX+WtYvJCiXJEMMisa5tnKbwTffvM\n01ps3K8s+zu0bzGczik3BtS81dMDBZiqxlJJJYV33q62s3IfYa1CM+dln7Co\nGjZKGkCXLyMxuc5sG/rISuzV4hH6lwtlojuolJp3NreJDdK2zMu4w8hLkATg\nA0Ru\r\n=RHB2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFI5ce3xh8f8KzwZwlUBghFkEGX+a97xhNmxhm3eJ/91AiEA3Xsj8hJTi2lFyEYuoGoxd2t1Gdd2uNQcA1iCqrErh4A="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.1-1_1550966230464_0.587433863049621"},"_hasShrinkwrap":false},"0.0.1":{"name":"@amilajack/joker","version":"0.0.1","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.3","@babel/plugin-proposal-class-properties":"^7.3.3","@babel/preset-env":"^7.3.1","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.6","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.1","@typescript-eslint/parser":"^1.4.1","assertion-error":"^1.1.0","babel-jest":"^24.1.0","cross-env":"^5.2.0","eslint":"^5.14.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"typings":"dist/index.d.ts","eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.1","dist":{"shasum":"e02d518b2f80dc21ef6e7fc1ed82c7c5a1dfebd5","integrity":"sha512-s3OjG1NHazb7MgDWD7HHYWQtH5p0uFdXqYXcL9xM/KIamX/KHydx3tNt4X+u7i+TBqoWdg43+ZTT5u7vesdf+g==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.1.tgz","fileCount":16,"unpackedSize":128039,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJccyiyCRA9TVsSAnZWagAAHJgP/jOas9arDI7D0B0eGrYr\nrIQAD0HbErdAWiV6VIWMqpXXdeR4bqG3m6aNqc59nlv1t46TO3EU7F4gbD33\nwklD2I9l47iXkmhRlZnB18yBOgEBAQIKnJMo2n3Osef22Dy82VJbM5+qqY4k\nigpKPPihgvhKdqAlLSMV72GMU8QKC1hDmJqnEvFjFrMYBuvJ6oSKsCaRbV2U\n/mqwvztWHm4t2TqUgoqalI5KRPEKbyWZoGTaK30mhBfqFqiG1wSKv8d+rEQT\nUQOZCZZ4J0Np9N7+Ds74z4M+aQh4xM2erziwpReeWK05oV0Nh26ir2ZBsSJ6\n+pNtpydxM2DN2KrkHUGXbODQLO6qDu0SO1+nXroGnLa7K2bNi6XlYob7+sUt\nbVgTDthOh3T3Vw/cwDEfHtds9wYfC9x/F+9Xa+mufIffcr3Cj+Fv5jqjneeo\neW9h8eiZ5JjAxhAxBFhjsO5wT9MmpQ68LvRtzW9rcOjOyQMwZ4fW5w8JTMAu\nAKypGPKCxn26K1LDP5qsqhF8PvqcLp7HP3wb690I4+5xxAG0ArqT/VTugwql\nOOnB+gpyOcTc8P8cKkylsXhbhcqF3Upyze+NaqskJHmx4Xhh0+ww+GRwjTBU\n5yzcZHsVlpy17wRQ0gz0s1QzV+qHgLck8bAviWHFlXUw7DXEu0RsViJwOu4G\nZfgO\r\n=E7Uo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFEWTwOXb5EObYmkxaAlTAJ7e/GLysCq0jcWjl6kB6hPAiEAs4l2piqmsbsHqhGsXyZ9pwX/ncSNmb170SCeEhY7aQU="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.1_1551050930129_0.3965599981202108"},"_hasShrinkwrap":false},"0.0.2":{"name":"@amilajack/joker","version":"0.0.2","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.3","@babel/plugin-proposal-class-properties":"^7.3.3","@babel/preset-env":"^7.3.1","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.6","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.1","@typescript-eslint/parser":"^1.4.1","babel-jest":"^24.1.0","cross-env":"^5.2.0","eslint":"^5.14.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"assertion-error":"^1.1.0","clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"typings":"dist/index.d.ts","eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.2","dist":{"shasum":"a9d8fb7a6aff8e71c2e33782f1a58ac6c405f55e","integrity":"sha512-VL2d1FkRwJG3IGv8FTXS9vYWCqK4a0koP4L7J63sIL+S0Eol8iESBEL85GGS7+ESKMax1qD3qldNEMry/XTDQg==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.2.tgz","fileCount":16,"unpackedSize":128275,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJccyyXCRA9TVsSAnZWagAAcNQQAJle8GNOBHkX3R7NLfXB\nfQsqLTQ4foQruV8ugDm/A+dJS6avTlr15wzWtedNimakCMeIXbwKE7XJG/ex\n8pXjUv0bGrGgysO+VQufrfok1svGTKqJq6YRTAbqRryam+SEJGmZBIEWgbw+\ntY1IOL1fr5JDXav0adE+rCJHCIYZ5wytvs4nETfDizQ8huYJ4c/o0yQ++BSZ\njqp9ZzphMBwGbOx9LAPuqI0mitnwVocewsiNs2vh66916Tw9Z5u9PCgxmSmI\n0DHovZVKKMXP83BaA6mN6dq6K++0owBvHv5SZuDDwmM5NKpiAsPN417S67Ec\nHm0CF1u9AGH9Ru5Etl5gVY1qcWbqe3BPYOoRK+vBejYFSoe0opdbQOhfsXS/\nC+cysXuVDv045BEI3Sx68ZSvj+KxfuSmnN+Xf+W7JbFmUH8gN1hXopAj3yHh\nWpuAAGBdLnPF0wWn9hCcM/j1vB2MMdll03Z9Uz1+qtVNS2pR8V+9pyVz5mWD\n6QhJwqUpjqIGkB63LxcEzafQG75R1G+W6R/GpEj9MX3GCVgD8zi3gx0NHjDn\niMawXxtIZJcigbImJbQE0hPp//0Kx0q/O11jwsGKD9/K0SK9o/T2O0HK4hAx\n4IfQ+aJTa+x4Up4gIZN0anU5GwiuCeNaghVhf9+T1dSVMLzp2uYEyCD0/xE5\n5IiP\r\n=Smc2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQ2SEmOjs/vontjQTeBi0EZ2NI7P9uKBYjkhw64IU8dAIgESkYfkrXlzp7K28CiLJbB69cPFwZDwklK/b6JIHx5Z0="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.2_1551051927207_0.019103803157433985"},"_hasShrinkwrap":false},"0.0.3-0":{"name":"@amilajack/joker","version":"0.0.3-0","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.3","@babel/plugin-proposal-class-properties":"^7.3.3","@babel/preset-env":"^7.3.1","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.6","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.1","@typescript-eslint/parser":"^1.4.1","babel-jest":"^24.1.0","cross-env":"^5.2.0","eslint":"^5.14.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"assertion-error":"^1.1.0","clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"typings":"dist/index.d.ts","eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"readmeFilename":"README.md","readme":"> ## 🛠 Status: In Development\n> Joker is currently in development. It's on the fast track to a 1.0 release, so we encourage you to use it and give us your feedback, but there are things that haven't been finalized yet and you can expect some changes.\n\n[![Build Status](https://dev.azure.com/amilajack/amilajack/_apis/build/status/amilajack.joker?branchName=master)](https://dev.azure.com/amilajack/amilajack/_build/latest?definitionId=1&branchName=master)\n[![NPM version](https://img.shields.io/npm/v/@amilajack/joker.svg)](https://www.npmjs.com/package/@amilajack/joker)\n[![npm](https://img.shields.io/npm/dm/@amilajack/joker.svg)](https://npm-stat.com/charts.html?package=@amilajack/joker)\n\nA modern and intuitive testing library for command-line apps\n\n## Installation\n\n```bash\n$ npm install --save @amilajack/joker\n```\n\n## How it looks\n\n```js\nconst path = require('path');\nconst { default: Joker } = require('@amilajack/joker');\n\n(async () => {\n  await new Joker()\n    .cwd(path.join(__dirname, 'fixtures'))\n    .env('NODE_ENV', 'production')\n    .before('touch /tmp/test')\n    .run('ls /tmp/')\n    .stdout(/test/)\n    .code(0)\n    .end();\n})();\n```\n\n## API\n\nSee [full API docs](https://amilajack.github.io/joker/classes/runner)\n\n## Features\n\n### Formatting options\n\nJoker can strip newlines and colors. You can tell it to do so by passing an\nobject that looks like this:\n\n```js\nconst options = {\n  colors: true,\n  newLines: true,\n};\n\nnew Joker(options)\n```\n\n### Custom expectations\n\nWhile Joker comes with built-in expectations, you can use your own too.\n\n```js\nawait new Joker()\n  .run('unicorns')\n  .expect((result) => {\n    if (result.stdout !== 'unicorns') {\n      return new Error('NO!');\n    }\n  })\n  .end();\n```\n\n### Custom middlewares\n\nYou can register as many before and after middlewares as you wish.\n\n```js\nawait new Joker()\n  .before(setupDatabase)\n  .before(runMigrations)\n  .run(cmd)\n  .after(downgradeCron)\n  .after(deleteDatabase)\n  .end();\n```\n\n### Middleware order\n\nThe Middleware execution order is very simple - \"before\" middlewares always run\nbefore everything else, \"after\" middlewares always run after everything else.\nThe other middlewares will match the order that you have specified.\n\n```js\nawait new Joker()\n  .before(before1)\n  .before(before2)\n  .after(after1)\n  .after(after2)\n  .writeFile(file, '')\n  .run(cmd)\n  .unlink(file)\n  .end();\n\n// Execution order:\n// before1, before2, writeFile, cmd, unlink, after1, after2\n```\n\nYou may also want to reuse before and after middlewares as much as possible,\nespecially when testing something that requires extensive setup and cleanup. You\ncan accomplish this by cloning a Joker instance.\n\n```js\nconst base = new Joker()\n  .before(setupDatabase)\n  .after(removeDatabase);\n\n// Later on\n\nbase.clone().run....\n```\n\n### Plugins\n\nJoker has primitive support for plugins. You can register any expectation or/and\nany middleware by calling `joker.register`.\n\n```js\nconst fn = () => {};\nnew Joker().register('foo', fn);\n```\n\nOr you may want to register many functions at once.\n\n```js\nconst fn = () => {};\nconst fn1 = () => {};\njoker.register({ baz: fn, bar: fn1 });\n```\n\n### Usage with a test runner\n\nJoker plays nice with any test runner out there.\n\n#### Jest\n\nHere is a minimal example how you could use it with [Jest](http://jestjs.io) using async/await:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', async () => {\n    const result = await new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end();\n    expect(result.stdout).toMatchSnapshot();\n  });\n});\n```\n\n#### Mocha\n\nHere is a minimal example how you could use it with [Mocha](http://mochajs.org) using callbacks:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', (done) => {\n    new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end(done);\n  });\n});\n```\n\n### Usage without a test runner\n\nWhile using a test runner is recommended Joker is completely 'nodeable'. Here is\na simple example how you could accomplish that:\n\n```js\nconst assert = require('assert');\n\nfunction refute(err) {\n  assert(!err);\n}\n\nnew Joker()\n  .run(cmd)\n  .end(refute);\n\nnew Joker()\n  .run(anotherCmd)\n  .end(refute);\n```\n\n### Responding to interactive prompts\n\nJoker can respond to apps that run interactively using the `on()` and\n`respond()` functions.\n\n```js\nawait new Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\nSee [`test/prompt.test.ts`](https://github.com/amilajack/joker/blob/master/tests/prompt.test.ts) for more examples.\n\n### Templates\n\nEvery `Joker` instance can be cloned, which allows you to build \"templates\" for tests. Here's some examples:\n\n```js\nconst template = new Joker()\n  .cwd(path.join(__dirname, 'fixtures'))\n  .run('echo test');\n\nconst test1 = await template\n  .clone()\n  .stdout(/test/)\n  .end()\n\nconst test2 = await template\n  .clone()\n  .stdout('test')\n  .end();\n```\n\n## Credits\n\nSpecial thanks to:\n\n- [Martin Lazarov](https://github.com/mlazarov)\n- [Radoslav Stankov](https://github.com/rstankov)\n\n## Support\n\nDo you like this project? Star the repository, spread the word - it really helps. You may want to follow\nme on [Twitter](https://twitter.com/amilajack) and\n[GitHub](https://github.com/amilajack). Thanks!\n\nIf this project is saving you (or your team) time, please consider supporting it on Patreon 👍 thank you!\n\n<p>\n  <a href=\"https://www.patreon.com/amilajack\">\n    <img src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\">\n  </a>\n</p>\n","licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.3-0","dist":{"shasum":"63d196245f2c19307ab5e73bf33761d9c5635f16","integrity":"sha512-bc9eyMJCooQ1Z1Pvyzt4QVwnnWIvBbXZMVbHvKc/ZiCR3Q5dJ6hGSqpb/Cwu/dr3ALTigZRaBaN1scKT1hlcqg==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.3-0.tgz","fileCount":16,"unpackedSize":128553,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcczQvCRA9TVsSAnZWagAAnyUP/36OPLaVF8JMvpnMhybd\nq4wGKlHuGLT+Dv2MzZI0a/MulODMaYruR5W4Kht1123bJ5YgOzLY9FmE9S2h\nJym12l8TJL48zGEEd7J4fSa8GaHeQ7M8A7n0w0wWjGFIzqOEoeygFEoPDBye\nZ0xi1DHJV1JQy4Si+E9qeIzLVswsKWUMLi7iIn+QLyVP6XzH3QqRNkv+OBy2\nVUADAOH8PtKd8X7HrHsKzXDxpJQEvFQAMBhpPYcdb0cnw17p0oXuY0CFWymp\nZ5XZhP4XbdZJuY9iAhM8uGVsuWBTsmC6R88HUVqeujG9E+lu7ttcfYoDGPQ7\n1bADdcLK4kdVDni9AftK+YlqIZn6GEv7ueTFvzoPAl2+u/hrFp1/bmOYXh+b\nfd7QJNMznnmXhYJrUp0Tv+ckzJD1KUEdHIQG0vSypIwjiK38a/VO9OTEtkhs\nQHlTTANYV/YA+yLU2fqKCscHII+Zmf5zjfCc2gEbjItIZtMEFxiwZwoOA56h\nHsnHkSGiU0LGYfdmcnwrnRd+RgjVaz84qdBwIiy6bjk5OyoOKLzxUUNU9KfB\nkCuD3XllIe+1UV2eoSrOysJ584wC1XxBeSN0wIZEQ5p1Cw6OJcRk457FVwnE\nnwG0SJ1HfIhv/BpITSp74Xwg4xNLtBpYrEuUc2VV5V3lyIVloBZhykYXHFcq\nzyJh\r\n=rKEy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDv9x34hhRyixq/xO6v/5QMYgE1fLgOF8l3CcM2tsLsxgIhAOOogHIbpUgs0lp15ei74jI+7NUu7GH/a7TqItMaJg0C"}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.3-0_1551053870592_0.6275111561026636"},"_hasShrinkwrap":false},"0.0.3-1":{"name":"@amilajack/joker","version":"0.0.3-1","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.3","@babel/plugin-proposal-class-properties":"^7.3.3","@babel/preset-env":"^7.3.1","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.6","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.1","@typescript-eslint/parser":"^1.4.1","babel-jest":"^24.1.0","cross-env":"^5.2.0","eslint":"^5.14.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"assertion-error":"^1.1.0","clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"typings":"dist/index.d.ts","eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"readmeFilename":"README.md","readme":"> ## 🛠 Status: In Development\n> Joker is currently in development. It's on the fast track to a 1.0 release, so we encourage you to use it and give us your feedback, but there are things that haven't been finalized yet and you can expect some changes.\n\n[![Build Status](https://dev.azure.com/amilajack/amilajack/_apis/build/status/amilajack.joker?branchName=master)](https://dev.azure.com/amilajack/amilajack/_build/latest?definitionId=1&branchName=master)\n[![NPM version](https://img.shields.io/npm/v/@amilajack/joker.svg)](https://www.npmjs.com/package/@amilajack/joker)\n[![npm](https://img.shields.io/npm/dm/@amilajack/joker.svg)](https://npm-stat.com/charts.html?package=@amilajack/joker)\n\nA modern and intuitive testing library for command-line apps\n\n## Installation\n\n```bash\n$ npm install --save @amilajack/joker\n```\n\n## How it looks\n\n```js\nconst path = require('path');\nconst { default: Joker } = require('@amilajack/joker');\n\n(async () => {\n  await new Joker()\n    .cwd(path.join(__dirname, 'fixtures'))\n    .env('NODE_ENV', 'production')\n    .before('touch /tmp/test')\n    .run('ls /tmp/')\n    .stdout(/test/)\n    .code(0)\n    .end();\n})();\n```\n\n## API\n\nSee [full API docs](https://amilajack.github.io/joker/classes/runner)\n\n## Features\n\n### Formatting options\n\nJoker can strip newlines and colors. You can tell it to do so by passing an\nobject that looks like this:\n\n```js\nconst options = {\n  colors: true,\n  newLines: true,\n};\n\nnew Joker(options)\n```\n\n### Custom expectations\n\nWhile Joker comes with built-in expectations, you can use your own too.\n\n```js\nawait new Joker()\n  .run('unicorns')\n  .expect((result) => {\n    if (result.stdout !== 'unicorns') {\n      return new Error('NO!');\n    }\n  })\n  .end();\n```\n\n### Custom middlewares\n\nYou can register as many before and after middlewares as you wish.\n\n```js\nawait new Joker()\n  .before(setupDatabase)\n  .before(runMigrations)\n  .run(cmd)\n  .after(downgradeCron)\n  .after(deleteDatabase)\n  .end();\n```\n\n### Middleware order\n\nThe Middleware execution order is very simple - \"before\" middlewares always run\nbefore everything else, \"after\" middlewares always run after everything else.\nThe other middlewares will match the order that you have specified.\n\n```js\nawait new Joker()\n  .before(before1)\n  .before(before2)\n  .after(after1)\n  .after(after2)\n  .writeFile(file, '')\n  .run(cmd)\n  .unlink(file)\n  .end();\n\n// Execution order:\n// before1, before2, writeFile, cmd, unlink, after1, after2\n```\n\nYou may also want to reuse before and after middlewares as much as possible,\nespecially when testing something that requires extensive setup and cleanup. You\ncan accomplish this by cloning a Joker instance.\n\n```js\nconst base = new Joker()\n  .before(setupDatabase)\n  .after(removeDatabase);\n\n// Later on\n\nbase.clone().run....\n```\n\n### Plugins\n\nJoker has primitive support for plugins. You can register any expectation or/and\nany middleware by calling `joker.register`.\n\n```js\nconst fn = () => {};\nnew Joker().register('foo', fn);\n```\n\nOr you may want to register many functions at once.\n\n```js\nconst fn = () => {};\nconst fn1 = () => {};\njoker.register({ baz: fn, bar: fn1 });\n```\n\n### Usage with a test runner\n\nJoker plays nice with any test runner out there.\n\n#### Jest\n\nHere is a minimal example how you could use it with [Jest](http://jestjs.io) using async/await:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', async () => {\n    const result = await new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end();\n    expect(result.stdout).toMatchSnapshot();\n  });\n});\n```\n\n#### Mocha\n\nHere is a minimal example how you could use it with [Mocha](http://mochajs.org) using callbacks:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', (done) => {\n    new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end(done);\n  });\n});\n```\n\n### Usage without a test runner\n\nWhile using a test runner is recommended Joker is completely 'nodeable'. Here is\na simple example how you could accomplish that:\n\n```js\nconst assert = require('assert');\n\nfunction refute(err) {\n  assert(!err);\n}\n\nnew Joker()\n  .run(cmd)\n  .end(refute);\n\nnew Joker()\n  .run(anotherCmd)\n  .end(refute);\n```\n\n### Responding to interactive prompts\n\nJoker can respond to apps that run interactively using the `on()` and\n`respond()` functions.\n\n```js\nawait new Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\nSee [`test/prompt.test.ts`](https://github.com/amilajack/joker/blob/master/tests/prompt.test.ts) for more examples.\n\n### Templates\n\nEvery `Joker` instance can be cloned, which allows you to build \"templates\" for tests. Here's some examples:\n\n```js\nconst template = new Joker()\n  .cwd(path.join(__dirname, 'fixtures'))\n  .run('echo test');\n\nconst test1 = await template\n  .clone()\n  .stdout(/test/)\n  .end()\n\nconst test2 = await template\n  .clone()\n  .stdout('test')\n  .end();\n```\n\n## Credits\n\nSpecial thanks to:\n\n- [Martin Lazarov](https://github.com/mlazarov)\n- [Radoslav Stankov](https://github.com/rstankov)\n\n## Support\n\nDo you like this project? Star the repository, spread the word - it really helps. You may want to follow\nme on [Twitter](https://twitter.com/amilajack) and\n[GitHub](https://github.com/amilajack). Thanks!\n\nIf this project is saving you (or your team) time, please consider supporting it on Patreon 👍 thank you!\n\n<p>\n  <a href=\"https://www.patreon.com/amilajack\">\n    <img src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\">\n  </a>\n</p>\n","licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.3-1","dist":{"shasum":"9572fa05b1dda7e348844c5da5f205203b74d7fb","integrity":"sha512-DNBSfUhMQYni6Nxfu2P9rYsi2FdfDYeiF/53Hns7lq7SgWBTm7ioELQjFHXGEWRbE4LnsrgAR1P4pX7pGbmKyQ==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.3-1.tgz","fileCount":16,"unpackedSize":129547,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcc0EVCRA9TVsSAnZWagAAmoAP/RVnL96STrJObSadNxz8\nsgVBGuI9qc9pq6aTkkp3gUnV4ozn9vRklnVwzhrMivKsVUE9T+4H0+eq0YQ/\nYq70+6q4bjhdOpbdt2+6Suw4Jz//46la6JOQhY9spILmcSRKC4Bi/6mAXpH9\nirsBBkPfegm/qNOXMBMJRuDvzJq37kOyNJFkTdEbsOqrIbpWvFd91gY020Rz\nQnoTd+Cm9GXHyp53ILajy3aOw2elU55TbSnAtWfu2DGRuffe1epSNTcVbd8C\nzuHVEjb1If+jYkdEpj9yBGY2Hl64tFNqCcsDsn9f2WqeaSCGPxaFK/MGppmf\nfmGTPMrYddYwNkVlUqm+bZ5ywHjHuouXvyj/hN8H46WBdaKFs1JuocxR8+im\nFcUwuNMUuHtT+RlIkcnPG2QXzhb6XuWP2ELeKLdKGqBovRoQg3/7XFv0Hi73\nqhedtPfHVG55rPaF0Q5iyy/Hg+ySrjp1eFLJwMSlGbrjJG78QGSfP7KOMjU5\nDZvtzWwnkgcPLCoRR0u5A6NokLwVWSSheAPPpOHSMnuBewUszGhGDHYCsznd\nx0RGToMsSqndpBVgLj870lPhIgDQaZuDaYJsKFukGDcNT03D/IzRxtQkNK0I\n97T/dmB47J48d4wiVE+KKMAN2GBzmb0rVEAELDih+eDBaTzGtLByGevmCqKQ\n6GLt\r\n=Hq7u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIANzymZ2p9LxNl1glx2dddT4e/8AbASy4GPMYd993MFSAiEA0i/A49qdONCKSbTstizynsti1CGiOSTAfs+1dQaOEI8="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.3-1_1551057172963_0.992149139534328"},"_hasShrinkwrap":false},"0.0.3-2":{"name":"@amilajack/joker","version":"0.0.3-2","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.4","@babel/plugin-proposal-class-properties":"^7.3.4","@babel/preset-env":"^7.3.4","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.9","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.2","@typescript-eslint/parser":"^1.4.2","babel-jest":"^24.1.0","cross-env":"^5.2.0","eslint":"^5.15.0","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"assertion-error":"^1.1.0","clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"typings":"dist/index.d.ts","eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"readmeFilename":"README.md","readme":"> ## 🛠 Status: In Beta\n> Joker is currently in beta. It's on the fast track to a 1.0 release, so we encourage you to use it and give us your feedback, but there are things that haven't been finalized yet and you can expect some changes.\n\n[![Build Status](https://dev.azure.com/amilajack/amilajack/_apis/build/status/amilajack.joker?branchName=master)](https://dev.azure.com/amilajack/amilajack/_build/latest?definitionId=1&branchName=master)\n[![NPM version](https://img.shields.io/npm/v/@amilajack/joker.svg)](https://www.npmjs.com/package/@amilajack/joker)\n[![npm](https://img.shields.io/npm/dm/@amilajack/joker.svg)](https://npm-stat.com/charts.html?package=@amilajack/joker)\n\nA modern and intuitive testing library for command-line apps\n\n## Installation\n\n```bash\n$ npm install --save @amilajack/joker\n```\n\n## How it looks\n\n```js\nconst path = require('path');\nconst { default: Joker } = require('@amilajack/joker');\n\n(async () => {\n  await new Joker()\n    .cwd(path.join(__dirname, 'fixtures'))\n    .env('NODE_ENV', 'production')\n    .before('touch /tmp/test')\n    .run('ls /tmp/')\n    .stdout(/test/)\n    .code(0)\n    .end();\n})();\n```\n\n## API\n\nSee [full API docs](https://amilajack.github.io/joker/classes/runner)\n\n## Features\n\n### Formatting options\n\nJoker can strip newlines and colors. You can tell it to do so by passing an\nobject that looks like this:\n\n```js\nconst options = {\n  colors: true,\n  newLines: true,\n};\n\nnew Joker(options)\n```\n\n### Custom expectations\n\nWhile Joker comes with built-in expectations, you can use your own too.\n\n```js\nawait new Joker()\n  .run('unicorns')\n  .expect((result) => {\n    if (result.stdout !== 'unicorns') {\n      return new Error('NO!');\n    }\n  })\n  .end();\n```\n\n### Custom middlewares\n\nYou can register as many before and after middlewares as you wish.\n\n```js\nawait new Joker()\n  .before(setupDatabase)\n  .before(runMigrations)\n  .run(cmd)\n  .after(downgradeCron)\n  .after(deleteDatabase)\n  .end();\n```\n\n### Middleware order\n\nThe Middleware execution order is very simple - \"before\" middlewares always run\nbefore everything else, \"after\" middlewares always run after everything else.\nThe other middlewares will match the order that you have specified.\n\n```js\nawait new Joker()\n  .before(before1)\n  .before(before2)\n  .after(after1)\n  .after(after2)\n  .writeFile(file, '')\n  .run(cmd)\n  .unlink(file)\n  .end();\n\n// Execution order:\n// before1, before2, writeFile, cmd, unlink, after1, after2\n```\n\nYou may also want to reuse before and after middlewares as much as possible,\nespecially when testing something that requires extensive setup and cleanup. You\ncan accomplish this by cloning a Joker instance.\n\n```js\nconst base = new Joker()\n  .before(setupDatabase)\n  .after(removeDatabase);\n\n// Later on\n\nbase.clone().run....\n```\n\n### Plugins\n\nJoker has primitive support for plugins. You can register any expectation or/and\nany middleware by calling `joker.register`.\n\n```js\nconst fn = () => {};\nnew Joker().register('foo', fn);\n```\n\nOr you may want to register many functions at once.\n\n```js\nconst fn = () => {};\nconst fn1 = () => {};\njoker.register({ baz: fn, bar: fn1 });\n```\n\n### Usage with a test runner\n\nJoker plays nice with any test runner out there.\n\n#### Jest\n\nHere is a minimal example how you could use it with [Jest](http://jestjs.io) using async/await:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', async () => {\n    const result = await new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end();\n    expect(result.stdout).toMatchSnapshot();\n  });\n});\n```\n\n#### Mocha\n\nHere is a minimal example how you could use it with [Mocha](http://mochajs.org) using callbacks:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', (done) => {\n    new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end(done);\n  });\n});\n```\n\n### Usage without a test runner\n\nWhile using a test runner is recommended Joker is completely 'nodeable'. Here is\na simple example how you could accomplish that:\n\n```js\nconst assert = require('assert');\n\nfunction refute(err) {\n  assert(!err);\n}\n\nnew Joker()\n  .run(cmd)\n  .end(refute);\n\nnew Joker()\n  .run(anotherCmd)\n  .end(refute);\n```\n\n### Responding to interactive prompts\n\nJoker can respond to apps that run interactively using the `on()` and\n`respond()` functions.\n\n```js\nawait new Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\nSee [`test/prompt.test.ts`](https://github.com/amilajack/joker/blob/master/tests/prompt.test.ts) for more examples.\n\n### Templates\n\nEvery `Joker` instance can be cloned, which allows you to build \"templates\" for tests. Here's some examples:\n\n```js\nconst template = new Joker()\n  .cwd(path.join(__dirname, 'fixtures'))\n  .run('echo test');\n\nconst test1 = await template\n  .clone()\n  .stdout(/test/)\n  .end()\n\nconst test2 = await template\n  .clone()\n  .stdout('test')\n  .end();\n```\n\n## Credits\n\nSpecial thanks to:\n\n- [Martin Lazarov](https://github.com/mlazarov)\n- [Radoslav Stankov](https://github.com/rstankov)\n\n## Support\n\nDo you like this project? Star the repository, spread the word - it really helps. You may want to follow\nme on [Twitter](https://twitter.com/amilajack) and\n[GitHub](https://github.com/amilajack). Thanks!\n\nIf this project is saving you (or your team) time, please consider supporting it on Patreon 👍 thank you!\n\n<p>\n  <a href=\"https://www.patreon.com/amilajack\">\n    <img src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\">\n  </a>\n</p>\n","licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.3-2","dist":{"shasum":"8cb40f31ce259434be48a4b8255c99c06369249e","integrity":"sha512-S9BGTEEVcoIAKp2GC6BYwrqz80YpxEzCyCk6Mc9ybx9R6UTHbohXZJa5OMBCpuyERRzmsflpJ2ONi+kQhc0qCQ==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.3-2.tgz","fileCount":16,"unpackedSize":129682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcerh3CRA9TVsSAnZWagAAXK0P/2B9mh+n+f0YskWILqk1\nb4h0fxUlJr3RyLzW+qzEj7E1cp/7pVf5WqyKswn6ExXNHjL+Ke62J0NrqQNg\n93CRHt6aumXiiApACYUnkZ7uDpft0Ab4jvU3wZE50p/AxYngKw0/9WCTBei8\n5QVr0qKPF4hf1eXyZLT757Nec2KYwGzfFec95dRD9esEseTTkqb7LO7he+3V\nx7FXntOaHJ6vfMgjDlRp5EyoiWAfIz//qPP2gN8IfPWlb929GvkXP49ca25R\nDlc9yL1e+1Kvil9LHX7FaNMiQpsaKeRNIpKjLO+P9+I50kYdNhtSKVXZgEwg\npTKrU6/a7pLdHCVtFlPX3Wfn/oZqMdt4h5PM0oe5QPYaux7gYPeFedZWQU2U\nDbJoEeK9SadYYLHpgU7mLw4xx66lhNfgN9MIjFfTEKPtuv23y4FczL9p20tl\n9oVx1Vj9MVksrdYro8TeBW1cbq5gpXiNwdP4Cx90qk6Y2Ri5VtlHC7x7P+VI\nuh06V6mSY75KmxE6fQZx3qc6KTOT43oUNx9AJZWD1oKDb6cMxEsexMPKkkeX\n8U5Pgn/ttYQVjzsRjqLvQr1a3bKd6tnC4it4TC/s+Ifa9MCOoHKeJ7ki9TED\no+L3Kal6XCgY+xeTua4aNkbMyUSWvKSSWdx2BAQzfeAMySCbxPDW12bnspDv\nOmCn\r\n=cpww\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDtjMTz3B/Hg3afZ8zHtC5zc8uiUonOJH5/3Hi8zVooTwIgIRgYUoWiPitvBdWoQngzmysRTek5xNHwhtZJtUCAI6c="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.3-2_1551546486806_0.44218505341423997"},"_hasShrinkwrap":false},"0.0.3-3":{"name":"@amilajack/joker","version":"0.0.3-3","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.4","@babel/plugin-proposal-class-properties":"^7.3.4","@babel/preset-env":"^7.3.4","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.9","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.2","@typescript-eslint/parser":"^1.4.2","babel-jest":"^24.1.0","cross-env":"^5.2.0","eslint":"^5.15.0","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","lint-staged":"^8.1.5","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"assertion-error":"^1.1.0","clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"lint-staged && yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"lint-staged":{"linters":{"*.{ts,js}":["eslint","git add"]}},"readmeFilename":"README.md","readme":"![logo](./logo.jpg)\n\n> ## 🛠 Status: In Beta\n> Joker is currently in beta. It's on the fast track to a 1.0 release, so we encourage you to use it and give us your feedback, but there are things that haven't been finalized yet and you can expect some changes.\n\n[![Build Status](https://dev.azure.com/amilajack/amilajack/_apis/build/status/amilajack.joker?branchName=master)](https://dev.azure.com/amilajack/amilajack/_build/latest?definitionId=1&branchName=master)\n[![NPM version](https://img.shields.io/npm/v/@amilajack/joker.svg)](https://www.npmjs.com/package/@amilajack/joker)\n[![npm](https://img.shields.io/npm/dm/@amilajack/joker.svg)](https://npm-stat.com/charts.html?package=@amilajack/joker)\n\nA modern and intuitive testing library for command-line apps\n\n## Installation\n\n```bash\n$ npm install --save @amilajack/joker\n```\n\n## How it looks\n\n```js\nconst path = require('path');\nconst { default: Joker } = require('@amilajack/joker');\n\n(async () => {\n  await new Joker()\n    .cwd(path.join(__dirname, 'fixtures'))\n    .env('NODE_ENV', 'production')\n    .before('touch /tmp/test')\n    .run('ls /tmp/')\n    .stdout(/test/)\n    .code(0)\n    .end();\n})();\n```\n\n## API\n\nSee [full API docs](https://amilajack.github.io/joker/classes/runner)\n\n## Features\n\n### Formatting options\n\nJoker can strip newlines and colors. You can tell it to do so by passing an\nobject that looks like this:\n\n```js\nconst options = {\n  colors: true,\n  newLines: true,\n};\n\nnew Joker(options)\n```\n\n### Custom expectations\n\nWhile Joker comes with built-in expectations, you can use your own too.\n\n```js\nawait new Joker()\n  .run('unicorns')\n  .expect((result) => {\n    if (result.stdout !== 'unicorns') {\n      return new Error('NO!');\n    }\n  })\n  .end();\n```\n\n### Custom middlewares\n\nYou can register as many before and after middlewares as you wish.\n\n```js\nawait new Joker()\n  .before(setupDatabase)\n  .before(runMigrations)\n  .run(cmd)\n  .after(downgradeCron)\n  .after(deleteDatabase)\n  .end();\n```\n\n### Middleware order\n\nThe Middleware execution order is very simple - \"before\" middlewares always run\nbefore everything else, \"after\" middlewares always run after everything else.\nThe other middlewares will match the order that you have specified.\n\n```js\nawait new Joker()\n  .before(before1)\n  .before(before2)\n  .after(after1)\n  .after(after2)\n  .writeFile(file, '')\n  .run(cmd)\n  .unlink(file)\n  .end();\n\n// Execution order:\n// before1, before2, writeFile, cmd, unlink, after1, after2\n```\n\nYou may also want to reuse before and after middlewares as much as possible,\nespecially when testing something that requires extensive setup and cleanup. You\ncan accomplish this by cloning a Joker instance.\n\n```js\nconst base = new Joker()\n  .before(setupDatabase)\n  .after(removeDatabase);\n\n// Later on\n\nbase.clone().run....\n```\n\n### Plugins\n\nJoker has primitive support for plugins. You can register any expectation or/and\nany middleware by calling `joker.register`.\n\n```js\nconst fn = () => {};\nnew Joker().register('foo', fn);\n```\n\nOr you may want to register many functions at once.\n\n```js\nconst fn = () => {};\nconst fn1 = () => {};\njoker.register({ baz: fn, bar: fn1 });\n```\n\n### Usage with a test runner\n\nJoker plays nice with any test runner out there.\n\n#### Jest\n\nHere is a minimal example how you could use it with [Jest](http://jestjs.io) using async/await:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', async () => {\n    const result = await new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end();\n    expect(result.stdout).toMatchSnapshot();\n  });\n});\n```\n\n#### Mocha\n\nHere is a minimal example how you could use it with [Mocha](http://mochajs.org) using callbacks:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', (done) => {\n    new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end(done);\n  });\n});\n```\n\n### Usage without a test runner\n\nWhile using a test runner is recommended Joker is completely 'nodeable'. Here is\na simple example how you could accomplish that:\n\n```js\nconst assert = require('assert');\n\nfunction refute(err) {\n  assert(!err);\n}\n\nnew Joker()\n  .run(cmd)\n  .end(refute);\n\nnew Joker()\n  .run(anotherCmd)\n  .end(refute);\n```\n\n### Responding to interactive prompts\n\nJoker can respond to apps that run interactively using the `on()` and\n`respond()` functions.\n\n```js\nawait new Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\nSee [`test/prompt.test.ts`](https://github.com/amilajack/joker/blob/master/tests/prompt.test.ts) for more examples.\n\n### Templates\n\nEvery `Joker` instance can be cloned, which allows you to build \"templates\" for tests. Here's some examples:\n\n```js\nconst template = new Joker()\n  .cwd(path.join(__dirname, 'fixtures'))\n  .run('echo test');\n\nconst test1 = await template\n  .clone()\n  .stdout(/test/)\n  .end()\n\nconst test2 = await template\n  .clone()\n  .stdout('test')\n  .end();\n```\n\n## Credits\n\nSpecial thanks to:\n\n- [Martin Lazarov](https://github.com/mlazarov)\n- [Radoslav Stankov](https://github.com/rstankov)\n\n## Support\n\nDo you like this project? Star the repository, spread the word - it really helps. You may want to follow\nme on [Twitter](https://twitter.com/amilajack) and\n[GitHub](https://github.com/amilajack). Thanks!\n\nIf this project is saving you (or your team) time, please consider supporting it on Patreon 👍 thank you!\n\n<p>\n  <a href=\"https://www.patreon.com/amilajack\">\n    <img src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\">\n  </a>\n</p>\n","licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.3-3","dist":{"shasum":"7208b53d6438e7427e740ec6a265e7b9e6e4b6fc","integrity":"sha512-ir2CfL5/dDWc+68f21eoKhw+EfnQv6gaS6qYfNucW5+3IwN3GFxVHC8ia10IQ3st70Gl+d1LWjqoq7i2dmg74A==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.3-3.tgz","fileCount":16,"unpackedSize":132093,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJce0onCRA9TVsSAnZWagAAf2kP+wWACSQebn5x+MbPswQf\nS92q8Qt8Um58lyn1nbvMAu/Z46bfbmU87XOIRzWFbkYB97WUTb/qlk8MOz16\nxuMQhEst59j2ecF6nB7XfueUsQRinTKHJnpYPdfdWwW4fNt3ILo/Vxp2Pr24\n7/Fgoj5AgEUZVz6cDvILRlrCSp3+sVo7MEiTWEcKAnAf2+XBrrBGkUvoCtRm\nXN3pHsWlcS5woFwwqHHtyXBwBnZyvjevH1it0cQffMdFB8E3h8BzkQs8v/JD\n+PNOKO0Zs4QXsD4EDDJVmYPvOSwGyP+QET/kvYythPS972z2I9LgfO6RvFuj\nhKffHLoBCrUnAkZYTSKoHY5z/bbMUCGXOgOaM5zJiAtuUDNsekmJ2Sb7xMAu\nREbFJHzwuuXyzr2BGGqFfOkLJeXpMbrtgguLSadMh5IL32vtOabWwzRR2ACj\nKMSdmZTEuWCzMUMUzy3ApOBcdVn8at3QwaYEqA3A61vO6jgMElhJRb1VYSX7\nuHu9b1PbLwREE6YO+tAMIkBuHTKw4zUha2voqLDJ6sdmRoF0i2ztQ6/auxSZ\np2V2IRV0eUcRX7Uzx+h1876EIlApJn1mkf8VhWXxUX+AnTLARdBmYuDbm2Uy\n4WkqZLsv7nTpZEhCiQzo6N+znkrz/9jlxvb6cvOCU6Zt6Kr5MGbQkt6CVBK2\nqeBE\r\n=IYsP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1sMMgm8uWplm2WiFm+mGAx9lJ6C0b/2RlUvEOHx5i+gIhAMrrE00irdP0aHfrbhqJNhvI89zeXYIN5xOGrv2CcYp+"}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.3-3_1551583782706_0.9740425667784052"},"_hasShrinkwrap":false},"0.0.3":{"name":"@amilajack/joker","version":"0.0.3","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.4","@babel/plugin-proposal-class-properties":"^7.3.4","@babel/preset-env":"^7.3.4","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.9","@types/node":"^11.9.5","@typescript-eslint/eslint-plugin":"^1.4.2","@typescript-eslint/parser":"^1.4.2","babel-jest":"^24.1.0","codecov":"^3.2.0","cross-env":"^5.2.0","eslint":"^5.15.0","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.1.0","lint-staged":"^8.1.5","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"assertion-error":"^1.1.0","clone":"^2.1.2","expect":"^24.1.0","shell-quote":"^1.6.1"},"eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"lint-staged && yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"lint-staged":{"linters":{"*.{ts,js}":["eslint","git add"]}},"licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.3","dist":{"shasum":"aa685755c721c58877c33c8cdb15c88961d55ed6","integrity":"sha512-EORe7IMcQGYq3eHJxs/is+Jr5rV+WKrCcugeTxR4kE6l46HZZjo64l9ka0zaw8mtcodaiYWgFO/s/cCzqqYd5g==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.3.tgz","fileCount":16,"unpackedSize":133095,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfCmiCRA9TVsSAnZWagAA7hsP/ROCBj8SmoVfY5JhV9D/\ndcAIxVf/7YZ3A59PPP6E9yr16FU+ZHvRkqNQFkekuZqG5IXYIcvV+i+dfM+y\nml9xCL3pXprsJyMogQYyT/SEf9DmlTpmej32TCxwPmXhlubgt9x7nzDOv3vs\ns29yl3RmDnB9v30HFzF4HjbXyhOR01qRx0y4sZN/AJJfYcI94fwVKx8uSaKG\nwcDnA4l2WdrOo/0PnHrW1hCWvSlIajbfKT+ZL+vwybfSzvZ94wLirvNXJCHr\njLeYuqfwLcSv4jki+s1J8Lk39aiM3zDxCzxRbMPHCngDTtgkOnGCS4TeTq8J\nMRuvQJcf0RiHye9+BmXNDKqm8c+4MfNEdCOOj7BpKfF7LKGVWner2Rn0WAXG\nln+wLkjgXDHQa/lCreYXUsnMxcgRuai71gludTKnrOQVYR77WZej0LnrSoUu\nMVaxuOM8vDGkoMcbIHjr0zNqIklJQn/YB5Uhe39PnoJSPjZtQl/R0vqzreUB\nXLjxJ6em5339Vz+DYEisHyrQnHYl1UtHsyLvfEH+d30gm1/dPxJGZT+yAbfG\n6KtOH1fayAUfQ4AWaybf+sGM5Qt4E57BA36B2bUUKRIofMsEKxw08BWdd8U1\np3OPC+GJw3yZ0Qazl9tb6kaXwoAGGkrRd9Fcmo9nOOeMeg+e10WsAKHBrgty\nrEmH\r\n=HFmU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnIBL67ObWEHtCK/Wuea6Bs15+4Mu1I6DXPtXUhOk+kgIhALU8VWS2WSE+/G/h9ZleKAAb1aqgwJqNbGetO/DVNdpc"}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.3_1551640993786_0.8466792289940477"},"_hasShrinkwrap":false},"0.0.4":{"name":"@amilajack/joker","version":"0.0.4","description":"Simple and powerful testing for command-line apps","keywords":["cli","command line","e2e","end to end","test"],"main":"./dist","homepage":"https://github.com/amilajack/joker","scripts":{"build":"cross-env NODE_ENV=production babel src --out-dir dist --extensions \".ts\" --source-maps inline","docs":"rm -rf docs && typedoc ./src --out docs","lint":"eslint --ext .ts --ext .js .","spec":"jest --runInBand","test":"yarn ts && yarn lint && yarn build && yarn spec","ts":"tsc","prepublish":"yarn test && yarn ts:dec","ts:dec":"yarn ts --declaration"},"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","devDependencies":{"@babel/cli":"^7.2.3","@babel/core":"^7.3.4","@babel/plugin-proposal-class-properties":"^7.3.4","@babel/preset-env":"^7.3.4","@babel/preset-typescript":"^7.3.3","@types/assertion-error":"^1.1.0","@types/clone":"^0.1.30","@types/expect":"^1.20.4","@types/jest":"^24.0.11","@types/node":"^11.11.3","@typescript-eslint/eslint-plugin":"^1.4.2","@typescript-eslint/parser":"^1.4.2","babel-jest":"^24.5.0","codecov":"^3.2.0","cross-env":"^5.2.0","eslint":"^5.15.1","eslint-config-airbnb-base":"^13.1.0","eslint-config-bliss":"^3.3.0","eslint-import-resolver-typescript":"^1.1.1","flow":"^0.2.3","husky":"^1.3.1","jest":"^24.5.0","lint-staged":"^8.1.5","prompt":"^1.0.0","rimraf":"^2.6.3","typedoc":"^0.14.2","typescript":"^3.3.3333"},"dependencies":{"assertion-error":"^1.1.0","clone":"^2.1.2","expect":"^24.5.0","shell-quote":"^1.6.1"},"eslintConfig":{"extends":["plugin:@typescript-eslint/recommended","prettier","prettier/@typescript-eslint"],"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint","prettier"],"rules":{"@typescript-eslint/explicit-function-return-type":"off","no-useless-constructor":"off","prettier/prettier":["error",{"singleQuote":true,"endOfLine":"auto"}]},"settings":{"import/resolver":{"typescript":{}}},"parserOptions":{"sourceType":"module"},"env":{"es6":true,"node":true}},"jest":{"testEnvironment":"node"},"husky":{"hooks":{"pre-commit":"lint-staged && yarn test"}},"renovate":{"extends":["bliss"]},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":10}}],["@babel/preset-typescript",{"allExtensions":true}]],"plugins":["@babel/plugin-proposal-class-properties"]},"lint-staged":{"linters":{"*.{ts,js}":["eslint","git add"]}},"licenseText":"MIT License\n\nCopyright (C) 2018-present Amila Welihinda\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial\nportions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO\nTHE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@amilajack/joker@0.0.4","dist":{"shasum":"910014b0af5d79e65939d7902184273b307e6293","integrity":"sha512-hSLnXDf/6Oy/8UoeURkS+bEuaLyRgnIRXJVMR7fLYFYYWLDzbBBiypFN8LDbNJg8y0U9+1JNuX5MnmC3cpzDJA==","tarball":"https://registry.npmjs.org/@amilajack/joker/-/joker-0.0.4.tgz","fileCount":16,"unpackedSize":133000,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJck/ZMCRA9TVsSAnZWagAAm40QAIGcZpUjBq6nmQi3mYhQ\nLn4oD2aOswtqWbQxPNu9535dFOzoohIuOETJ3CuGZPYnptdflZhzNd9q+2UT\n4xCdvzHR0YUy4v5CYQC0sROgJmX9axtrcYWOdgv5Z8SjyuEeOcpZ3ucGWebd\nzgwjjnzd9EZ+oiweM3eyF8f4WzMyfxMNzRAQJRPTfVjdRfDP9LAZ+kJYWVS8\nqmFDsMDgBnP38QfvBzt2ZdRiGuH0fEd9F4nKEEIEWEdwZ1AD+fx4yS/VKMra\niBysAO8frsC2n4SONqaQlyIvmvdmTyLFR0Ea6HwtB/dmlCfWL5qa5QUig178\nA2LqD3tEm7zzTMVM7NW2o68w/oCGw/ZK7go42E7gfTfFs911gbGovi0PoxBH\nnzRvGtR2r9oYcxwjuXhCl/4KoE0vNhqTb5/1hD08Ozgd0fOBOr93t7ZonZQD\n2iAY3cf6QfsSl9ZpXAqGP+GyY2DricL+83+c9Fi4CgQko40bZfeG7+AmTOBZ\nzHhkvQsPnSmjJMz5feXJvuOSiAYJDQe5tzSna7krw8W8GRJvcKBxwSwypPXl\nGdjHkycJ2aeoMBhS1YuVKu0MjjDgaN9F434KVD9ZfnGLBDKeBdZwlKF4Q75o\nvWstvN+XOwWl32Vmu0o4lYtUgCgCfwsxQ3OxvG3d7YAM8fk/GE9gfonQdBqP\nrCEY\r\n=jolR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCywGO7gciLgNuQltwBkUTPfQdpk//V5qv2IHC9zf9tcAIgReoiFXxqfoRcqpmOF7wyvZryHnabdQTinFJKiuqaJcI="}]},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"_npmUser":{"name":"amilajack","email":"amilajack@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joker_0.0.4_1553200714799_0.7044418736432669"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-22T05:39:44.284Z","0.0.0":"2019-02-22T05:39:44.612Z","modified":"2022-04-04T13:48:45.439Z","0.0.1-0":"2019-02-22T05:44:24.120Z","0.0.1-1":"2019-02-23T23:57:10.612Z","0.0.1":"2019-02-24T23:28:50.330Z","0.0.2":"2019-02-24T23:45:27.301Z","0.0.3-0":"2019-02-25T00:17:50.730Z","0.0.3-1":"2019-02-25T01:12:53.062Z","0.0.3-2":"2019-03-02T17:08:06.935Z","0.0.3-3":"2019-03-03T03:29:42.880Z","0.0.3":"2019-03-03T19:23:13.920Z","0.0.4":"2019-03-21T20:38:35.028Z"},"maintainers":[{"name":"amilajack","email":"amilajack@gmail.com"}],"description":"Simple and powerful testing for command-line apps","homepage":"https://github.com/amilajack/joker","keywords":["cli","command line","e2e","end to end","test"],"repository":{"type":"git","url":"git://github.com/amilajack/joker.git"},"author":{"name":"Amila Welihinda","email":"amilajack@gmail.com"},"license":"MIT","readme":"![logo](./logo.jpg)\n\n[![Build Status](https://dev.azure.com/amilajack/amilajack/_apis/build/status/amilajack.joker?branchName=master)](https://dev.azure.com/amilajack/amilajack/_build/latest?definitionId=1&branchName=master)\n[![NPM version](https://img.shields.io/npm/v/@amilajack/joker.svg)](https://www.npmjs.com/package/@amilajack/joker)\n[![npm](https://img.shields.io/npm/dm/@amilajack/joker.svg)](https://npm-stat.com/charts.html?package=@amilajack/joker)\n[![codecov](https://codecov.io/gh/amilajack/joker/branch/master/graph/badge.svg)](https://codecov.io/gh/amilajack/joker)\n\nA modern and intuitive testing library for command-line apps\n\n## Installation\n\n```bash\n$ npm install --save @amilajack/joker\n```\n\n## How it looks\n\n```js\nconst path = require('path');\nconst assert = require('assert');\nconst { default: Joker } = require('@amilajack/joker');\n\n(async () => {\n  await new Joker()\n    .run('echo hello')\n    .expect((result) => {\n      assert(result.stdout === 'hello');\n    })\n    .code(0)\n    .end();\n})();\n```\n\n## API\n\nSee [full API docs](https://amilajack.github.io/joker/classes/runner)\n\n## Features\n\n### Formatting options\n\nJoker can strip new line characters and colors. You can tell it to do so by passing an\nobject that looks like this:\n\n```js\nconst options = {\n  colors: false,\n  newLines: false\n};\n\nnew Joker(options);\n```\n\n### Custom expectations\n\nWhile Joker comes with built-in expectations, you can use your own too.\n\n```js\nawait new Joker()\n  .run('unicorns')\n  .expect(result => {\n    if (result.stdout !== 'unicorns') {\n      return new Error('NO!');\n    }\n  })\n  .end();\n```\n\n### Custom middlewares\n\nYou can register as many before and after middlewares as you wish.\n\n```js\nawait new Joker()\n  .before(setupDatabase)\n  .before(runMigrations)\n  .run(cmd)\n  .after(downgradeCron)\n  .after(deleteDatabase)\n  .end();\n```\n\n### Middleware order\n\nThe Middleware execution order is very simple - \"before\" middlewares always run\nbefore everything else, \"after\" middlewares always run after everything else.\nThe other middlewares will match the order that you have specified.\n\n```js\nawait new Joker()\n  .before(before1)\n  .before(before2)\n  .after(after1)\n  .after(after2)\n  .writeFile(file, '')\n  .run(cmd)\n  .unlink(file)\n  .end();\n\n// Execution order:\n// before1, before2, writeFile, cmd, unlink, after1, after2\n```\n\n### Plugins\n\nJoker has primitive support for plugins. You can register any expectation or/and\nany middleware by calling `joker.register`.\n\n```js\nconst fn = () => {};\nnew Joker().register('foo', fn);\n```\n\nOr you may want to register many functions at once.\n\n```js\nconst fn = () => {};\nconst fn1 = () => {};\njoker.register({ baz: fn, bar: fn1 });\n```\n\n### Usage with a test runner\n\nJoker plays nice with any test runner out there.\n\n#### Jest\n\nHere is a minimal example how you could use it with [Jest](http://jestjs.io) using async/await:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', async () => {\n    const result = await new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end();\n    expect(result.stdout).toMatchSnapshot();\n  });\n});\n```\n\n#### Mocha\n\nHere is a minimal example how you could use it with [Mocha](http://mochajs.org) using callbacks:\n\n```js\ndescribe('todo add', () => {\n  it('adds a new todo item', done => {\n    new Joker()\n      .run('todo add')\n      .stdout('A new todo has been added')\n      .end(done);\n  });\n});\n```\n\n### Usage without a test runner\n\nWhile using a test runner is recommended Joker is completely 'nodeable'. Here is\na simple example how you could accomplish that:\n\n```js\nconst assert = require('assert');\n\nfunction refute(err) {\n  assert(!err);\n}\n\nnew Joker()\n  .run(cmd)\n  .end(refute);\n\nnew Joker()\n  .run(anotherCmd)\n  .end(refute);\n```\n\n### Responding to interactive prompts\n\nJoker can respond to apps that run interactively using the `on()` and\n`respond()` functions.\n\n```js\nawait new Joker()\n  .run(cmd)\n  .on('Your name: ')\n  .respond('Joe User\\n')\n  .end();\n```\n\nSee [`test/prompt.test.ts`](https://github.com/amilajack/joker/blob/master/tests/prompt.test.ts) for more examples.\n\n### Templates\n\nEvery `Joker` instance can be cloned, which allows you to build \"templates\" for tests. Here's some examples:\n\n```js\nconst template = new Joker()\n  .cwd(path.join(__dirname, 'fixtures'))\n  .run('echo test');\n\nconst test1 = await template\n  .clone()\n  .stdout(/test/)\n  .end();\n\nconst test2 = await template\n  .clone()\n  .stdout('test')\n  .end();\n```\n\n## Credits\n\nSpecial thanks to:\n\n- [Martin Lazarov](https://github.com/mlazarov)\n- [Radoslav Stankov](https://github.com/rstankov)\n\n## Support\n\nDo you like this project? Star the repository, spread the word - it really helps. You may want to follow\nme on [Twitter](https://twitter.com/amilajack) and\n[GitHub](https://github.com/amilajack). Thanks!\n\nIf this project is saving you (or your team) time, please consider supporting it on Patreon 👍 thank you!\n\n<p>\n  <a href=\"https://www.patreon.com/amilajack\">\n    <img src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\">\n  </a>\n</p>\n","readmeFilename":"README.md"}