{"_id":"austin","_rev":"7-14d369d5f46b37044e04a14519643748","name":"austin","description":"Add the Powers of spying to JavaScript tests","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.1":{"name":"austin","version":"0.0.1","description":"Add the Powers of spying to JavaScript tests","main":"lib/index.js","scripts":{"test":"gulp test","coveralls":"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"},"repository":{"type":"git","url":"git+https://github.com/dustinspecker/austin.git"},"keywords":["austin","powers","spy","test"],"author":{"name":"Dustin Specker","email":"DustinSpecker@DustinSpecker.com","url":"github.com/dustinspecker"},"license":"MIT","files":["lib"],"dependencies":{"deep-equal":"^1.0.1"},"devDependencies":{"babel-core":"^6.0.12","babel-eslint":"^4.1.3","babel-preset-es2015":"^6.0.12","chai":"^3.0.0","coveralls":"^2.11.2","del":"^2.0.0","eslint-config-dustinspecker":"^0.1.0","eslint-path-formatter":"^0.1.1","eslint-plugin-no-use-extend-native":"^0.3.1","gulp":"^3.9.0","gulp-alex":"^2.0.0","gulp-babel":"^6.0.0","gulp-eslint":"^1.0.0","gulp-if":"^2.0.0","gulp-istanbul":"^0.10.0","gulp-jscs":"^3.0.0","gulp-jshint":"^1.11.0","gulp-mocha":"^2.1.0","gulp-plumber":"^1.0.1"},"gitHead":"51834dda8e3cbf91a24e81cfa8eef6db8ac523be","bugs":{"url":"https://github.com/dustinspecker/austin/issues"},"homepage":"https://github.com/dustinspecker/austin#readme","_id":"austin@0.0.1","_shasum":"c4ff16fa690df8724c1cfd9f44232d598ffcac94","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"},"dist":{"shasum":"c4ff16fa690df8724c1cfd9f44232d598ffcac94","tarball":"https://registry.npmjs.org/austin/-/austin-0.0.1.tgz","integrity":"sha512-3jst5TEwMCgTB0bU3YtDCmYEbVqGGT0z6QDJvwDWZVrfI3eAhcoatzgE5GP25jze0DIT6jMdc8O77uUGF8tQtw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAjxkwRP4jr4rqbaml/l37tmTzpf8szLmdT3wUSiyehOAiAyDxAEeGMCiiPdrnGxB0fp713o0f+GO+l+TiDBlNehiw=="}]},"maintainers":[{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"}]},"0.0.2":{"name":"austin","version":"0.0.2","description":"Add the Powers of spying to JavaScript tests","main":"lib/index.js","scripts":{"test":"gulp test","coveralls":"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"},"repository":{"type":"git","url":"git+https://github.com/dustinspecker/austin.git"},"keywords":["austin","powers","spy","test"],"author":{"name":"Dustin Specker","email":"DustinSpecker@DustinSpecker.com","url":"github.com/dustinspecker"},"license":"MIT","files":["lib"],"dependencies":{"deep-equal":"^1.0.1"},"devDependencies":{"babel-core":"^6.0.12","babel-eslint":"^4.1.3","babel-preset-es2015":"^6.0.12","chai":"^3.0.0","coveralls":"^2.11.2","del":"^2.0.0","eslint-config-dustinspecker":"^0.1.0","eslint-path-formatter":"^0.1.1","eslint-plugin-no-use-extend-native":"^0.3.1","gulp":"^3.9.0","gulp-alex":"^2.0.0","gulp-babel":"^6.0.0","gulp-eslint":"^1.0.0","gulp-if":"^2.0.0","gulp-istanbul":"^0.10.0","gulp-jscs":"^3.0.0","gulp-jshint":"^1.11.0","gulp-mocha":"^2.1.0","gulp-plumber":"^1.0.1"},"gitHead":"13f16afa973bbce5d0a98ccb8cf2b078fb5a6707","bugs":{"url":"https://github.com/dustinspecker/austin/issues"},"homepage":"https://github.com/dustinspecker/austin#readme","_id":"austin@0.0.2","_shasum":"8e922eea25916c45737131c9f9ad98e7be1f65e8","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"},"dist":{"shasum":"8e922eea25916c45737131c9f9ad98e7be1f65e8","tarball":"https://registry.npmjs.org/austin/-/austin-0.0.2.tgz","integrity":"sha512-eWeJjaxItrtC2unmxndo1VtUcwr7Q8rCTK3vKJFfqLaLD18+AZfrXxekuQIfNKrA7DbfiNV2PlFJawMN4YGRaw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYnTlbCT5u/k9NVhYWYW2J8BOkpauaT44wa6eqtUiy9QIhAO1wp2nPLV0WODtvmYl6r+NRjrChOCRl348DhFv0tK3P"}]},"maintainers":[{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"}]},"0.0.3":{"name":"austin","version":"0.0.3","description":"Add the Powers of spying to JavaScript tests","main":"lib/index.js","scripts":{"test":"gulp test","coveralls":"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"},"repository":{"type":"git","url":"git+https://github.com/dustinspecker/austin.git"},"keywords":["austin","powers","spy","test"],"author":{"name":"Dustin Specker","email":"DustinSpecker@DustinSpecker.com","url":"github.com/dustinspecker"},"license":"MIT","files":["lib"],"dependencies":{"deep-equal":"^1.0.1"},"devDependencies":{"babel-core":"^6.0.12","babel-eslint":"^4.1.3","babel-preset-es2015":"^6.0.12","chai":"^3.0.0","coveralls":"^2.11.2","del":"^2.0.0","eslint-config-dustinspecker":"^0.1.0","eslint-path-formatter":"^0.1.1","eslint-plugin-no-use-extend-native":"^0.3.1","gulp":"^3.9.0","gulp-alex":"^2.0.0","gulp-babel":"^6.0.0","gulp-eslint":"^1.0.0","gulp-if":"^2.0.0","gulp-istanbul":"^0.10.0","gulp-jscs":"^3.0.0","gulp-jshint":"^1.11.0","gulp-mocha":"^2.1.0","gulp-plumber":"^1.0.1"},"gitHead":"8397973fbf835a9a0d34fc36513062790df686c1","bugs":{"url":"https://github.com/dustinspecker/austin/issues"},"homepage":"https://github.com/dustinspecker/austin#readme","_id":"austin@0.0.3","_shasum":"570cb4bc19eedceeea4682fc03148f2b8148f7e4","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"},"dist":{"shasum":"570cb4bc19eedceeea4682fc03148f2b8148f7e4","tarball":"https://registry.npmjs.org/austin/-/austin-0.0.3.tgz","integrity":"sha512-jXgnSWcQ8oEEkDMYJGsl1hpbs9nQc+0e8hakcFFvKC6q0hpkUDUbpS9jv119at8wfU8IOtoNNVgvmkzfdtJzfg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCBG3TGJtbTh4NOMWL6A6/PJHcSr+z0SBPFYQf11RlUtAIgUoEQMtXS7wk/ocPkyoB15aoD9obiWMKqyCIgk6J0hPA="}]},"maintainers":[{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"}]},"0.1.0":{"name":"austin","version":"0.1.0","description":"Add the Powers of spying to JavaScript tests","main":"lib/index.js","scripts":{"test":"gulp test","coveralls":"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"},"repository":{"type":"git","url":"git+https://github.com/dustinspecker/austin.git"},"keywords":["austin","powers","spy","test"],"author":{"name":"Dustin Specker","email":"DustinSpecker@DustinSpecker.com","url":"github.com/dustinspecker"},"license":"MIT","files":["lib"],"dependencies":{"deep-equal":"^1.0.1"},"devDependencies":{"babel-core":"^6.0.12","babel-eslint":"^4.1.3","babel-preset-es2015":"^6.0.12","chai":"^3.0.0","coveralls":"^2.11.2","del":"^2.0.0","eslint-config-dustinspecker":"^0.1.0","eslint-path-formatter":"^0.1.1","eslint-plugin-new-with-error":"^1.1.0","eslint-plugin-no-use-extend-native":"^0.3.1","gulp":"^3.9.0","gulp-alex":"^2.0.0","gulp-babel":"^6.0.0","gulp-eslint":"^1.0.0","gulp-if":"^2.0.0","gulp-istanbul":"^0.10.0","gulp-jscs":"^3.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^2.1.0","gulp-plumber":"^1.0.1","jshint":"^2.8.0"},"gitHead":"cdb4f5d470be83587b78c48e98a86ee080aa393e","bugs":{"url":"https://github.com/dustinspecker/austin/issues"},"homepage":"https://github.com/dustinspecker/austin#readme","_id":"austin@0.1.0","_shasum":"8a9dbea1ae37c108c0fab75348d66a1faa294998","_from":".","_npmVersion":"3.4.1","_nodeVersion":"5.0.0","_npmUser":{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"},"dist":{"shasum":"8a9dbea1ae37c108c0fab75348d66a1faa294998","tarball":"https://registry.npmjs.org/austin/-/austin-0.1.0.tgz","integrity":"sha512-prTY5wg41bNQmd84ERZ1HPKVQTteevQ4M2umierDn3YUeYyuNPpYkfVl0XuZC2Jfaicv/3gTlKI5H6IXu2wAhA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEXEbSPTYuBcPIoufvajM8/rZzxc/ng60uc4JmFs9yciAiEAmsJO0tjWvpNAAJv5no2TaZFewMQrYivHHhxHjsbigN0="}]},"maintainers":[{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"}]},"0.1.1":{"name":"austin","version":"0.1.1","description":"Add the Powers of spying to JavaScript tests","main":"lib/index.js","scripts":{"test":"gulp test","coveralls":"cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"},"repository":{"type":"git","url":"git+https://github.com/dustinspecker/austin.git"},"keywords":["austin","powers","spy","test"],"author":{"name":"Dustin Specker","email":"DustinSpecker@DustinSpecker.com","url":"github.com/dustinspecker"},"license":"MIT","files":["lib"],"dependencies":{"deep-equal":"^1.0.1"},"devDependencies":{"babel-core":"^6.0.12","babel-eslint":"^4.1.3","babel-preset-es2015":"^6.0.12","chai":"^3.0.0","coveralls":"^2.11.2","del":"^2.0.0","eslint-config-dustinspecker":"^0.2.0","eslint-path-formatter":"^0.1.1","eslint-plugin-new-with-error":"^1.1.0","eslint-plugin-no-use-extend-native":"^0.3.1","gulp":"^3.9.0","gulp-alex":"^2.0.0","gulp-babel":"^6.0.0","gulp-eslint":"^1.0.0","gulp-if":"^2.0.0","gulp-istanbul":"^0.10.0","gulp-jscs":"^3.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^2.1.0","gulp-plumber":"^1.0.1","jshint":"^2.8.0"},"gitHead":"4f068656890b339e7854eed87a9889c927c59b65","bugs":{"url":"https://github.com/dustinspecker/austin/issues"},"homepage":"https://github.com/dustinspecker/austin#readme","_id":"austin@0.1.1","_shasum":"6c805df25f59edaccb742d7db0d3ab3efb877b0f","_from":".","_npmVersion":"3.4.1","_nodeVersion":"5.0.0","_npmUser":{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"},"dist":{"shasum":"6c805df25f59edaccb742d7db0d3ab3efb877b0f","tarball":"https://registry.npmjs.org/austin/-/austin-0.1.1.tgz","integrity":"sha512-UE6MtAsPf063V6nl3XxaYJAp2aKBtNDAdOWnM9oHn7+E/U8+glENFEgXEE6HPjL1VfokK/yzzObN2QvdMZN0Hw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEerfHoacDWbI7oWy8bVJUQY52F1nFkwXWDTHYhKGZvTAiANFbN2wYCuhBslAaYx9J8S3tw+8IAaMGiZDOSYdoiPYg=="}]},"maintainers":[{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"}]}},"readme":"# Austin\n[![NPM version](https://badge.fury.io/js/austin.svg)](https://badge.fury.io/js/austin) [![Build Status](https://travis-ci.org/dustinspecker/austin.svg)](https://travis-ci.org/dustinspecker/austin) [![Coverage Status](https://img.shields.io/coveralls/dustinspecker/austin.svg)](https://coveralls.io/r/dustinspecker/austin?branch=master)\n\n[![Code Climate](https://codeclimate.com/github/dustinspecker/austin/badges/gpa.svg)](https://codeclimate.com/github/dustinspecker/austin) [![Dependencies](https://david-dm.org/dustinspecker/austin.svg)](https://david-dm.org/dustinspecker/austin/#info=dependencies&view=table) [![DevDependencies](https://david-dm.org/dustinspecker/austin/dev-status.svg)](https://david-dm.org/dustinspecker/austin/#info=devDependencies&view=table)\n\n> Add the *Powers* of spying to JavaScript tests\n\n## Install\n```\nnpm install --save-dev austin\n```\n\n## Usage\n```javascript\nvar austin = require('austin');\n\nvar testSubject = {\n  testFunction: function () {\n    return 5;\n  },\n\n  anotherFunction: function () {\n    return 'hello';\n  }\n};\n\n// Inform Austin of the method to spy on...\naustin.spy(testSubject, 'testFunction');\n\n// Austin adds spy utilities...\ntestSubject.testFunction.callCount();\n// => 0\n\n// Austin allows executing the function...\ntestSubject.testFunction('green', 3, {x: ['seven']});\n// => 5\n\n// Austin tracks the number of times the spied function was called...\ntestSubject.testFunction.callCount();\n// => 1\n\n// And the parameters passed to each call of the spied function\ntestSubject.testFunction.calls[0];\n// => ['green', 3, {x: ['seven']}]\n\n// And knows if a Spied Function was called with params...\ntestSubject.testFunction.calledWith('green', 3, {x: ['seven']});\n// => true\ntestSubject.testFunction.calledWith('blue');\n// => false\n\n// And can intercept the return value of the Spied Function\ntestSubject.test.returns('a fake value');\ntestSubject.test();\n// => 'a fake value'\ntestSubject.test.throws(TypeError, 'Expected value to be a string');\ntestSubject.test();\n// => TypeError: Expected value to be a string\n\n// And can intercept the return value of the Spied Function with specific parameters\ntestSubject.test.withArgs('austin').returns('powers');\ntestSubject.test('austin');\n// => 'powers'\ntestSubject.test.withArgs('austin').callCount();\n// => 1\n\n// And supports chaining withArgs and returns\ntestSubject.test.returns('Groovy!')\n  .withArgs('austin').returns('powers')\n  .withArgs('oooo').returns('behave');\ntestSubject.test();\n// => 'Groovy!'\ntestSubject.test('austin');\n// => 'powers'\ntestSubject.test('oooo');\n// => 'behave'\ntestSubject.test('Dr. Evil');\n// => 'Groovy!'\n\n// And can chain initial spy call\naustin.spy(testSubject, 'anotherFunction').returns('bye')\n  .withArgs('live').returns('dangerously');\ntestSubject.anotherFunction();\n// => 'bye'\ntestSubject.anotherFunction('live');\n// => 'dangerously'\n\n// Austin can reset spy analytics and fake value returns...\ntestSubject.testFunction.withArgs('Dr.').returns('Evil');\ntestSubject.testFunction.reset();\ntestSubject.testFunction.callCount();\n// => 0\ntestSubject.testFunction.calls;\n// => []\ntestSubject.testFunction('Dr.');\n// => 5\n\n// When Austin is told to halt spying...\ntestSubject.testFunction.restore();\n\n// Spy utilities are removed...\ntestSubject.testFunction.callCount;\n// => undefined\n\n// And the function returns to its former self.\ntestSubject.testFunction();\n// => 5\n\n// And Austin is smart enough to make new spies...\nvar nigelPowers = austin.spy();\nnigelPowers.returns('Judo Chop');\nnigelPowers();\n// => 'Judo Chop'\n```\n\n## API\n### austin.spy()\n\nCreates a new [Spied Function](#spied-function).\n\n### austin.spy(obj, methodName)\n\nAdds spy related utilities to obj[methodName] by transforming the function to a [Spied Function](#spied-function).\n\nNote: returns [Spied Function](#spied-function) for easy chaining with [returns](#spiedfunctionreturnsvalue) and [withArgs](#spiedfunctionwithargsparams).\n\n#### obj\n\nType: `Object`\n\nAn object that has the desired method `methodName` to be spied on.\n\n#### methodName\n\nType: `*`\n\nCan be any type as long as `obj[methodName]` is a `function`.\n\n## Spied Function\n\nA Spied Function has additional properties and methods to aid testing\n\n### spiedFunction()\n\nExecutes the original function, while updating spy analytics such as call count.\n\n### spiedFunction.callCount()\n\nThe number of times spiedFunction was executed.\n\n### spiedFunction.calledWith(params)\n\nReturns a `Boolean` if spiedFunction was called with `params`.\n\n#### params\n\nType: `...*`\n\nParams is a list of any types.\n\n### spiedFunction.calls\n\nAn array of parameters passed to each execution of Spied Function.\n\n### spiedFunction.reset()\n\nResets spiedFunction.callCount() to 0, spiedFunction.calls to [], and resets any fake values set with [returns](#spiedfunctionreturnsvalue).\n\n### spiedFunction.restore()\n\nRestores the spiedFunction to its original function and removes all spy utilities.\n\n### spiedFunction.returns(value)\n\nWhen spiedFunction is called, it will return `value` instead of executing the original function.\n\nNote: returns spiedFunction for easy chaining with [withArgs](#spiedfunctionwithargsparams).\n\nNote: if calling `spiedFunction.withArgs(...).returns(...)` with `params` that already have a fake value, then the\nnew value passed to `returns` will override the previous value.\n\n#### value\n\nType: `*`\n\nAny value that is desired to be returned by spiedFunction().\n\n### spiedFunction.throws(errorType[, message])\n\nWhen spiedFunction is called, it will throw an error instance of `errorType` with an optional message `message`.\n\nNote: returns spiedFunction for easy chaining with [withArgs](#spiedfunctionwithargsparams).\n\nNote: `spiedFunction.throws` has priority over `spiedFunction.returns` regardless of order called.\n\n#### errorType\n\nType: `Error`\n\nAn instance of Error to be thrown.\n\n#### message\n\nType: `String`\n\nAn optional message to throw error with.\n\n### spiedFunction.withArgs(params)\n\nReturns an object with a [returns](#spiedfunctionreturnsvalue) method to fake return values of calls to spiedFunction with params and [callCount](#spiedfunctioncallcount) and a [throws](#spiedfunctionthrowserrortypes-message) to throw errors when spiedFunction is called with params.\n\nNote: `spiedFunction.withArgs(...).returns(...)` and `spiedFunction.withArgs(...).throws(...)` return spiedFunction for easy chaining like `spiedFunction.withArgs(...).returns(...).withArgs(...).returns(...)`.\n\n#### params\n\nType: `...*`\n\nAn array of any types\n\n## LICENSE\nMIT © [Dustin Specker](https://github.com/dustinspecker)\n","maintainers":[{"name":"dustinspecker","email":"DustinSpecker@DustinSpecker.com"}],"time":{"modified":"2022-06-13T03:46:37.510Z","created":"2015-11-07T20:05:47.653Z","0.0.1":"2015-11-07T20:05:47.653Z","0.0.2":"2015-11-09T23:52:00.530Z","0.0.3":"2015-11-11T00:46:31.287Z","0.1.0":"2015-12-03T01:51:31.750Z","0.1.1":"2016-01-05T23:51:58.737Z"},"homepage":"https://github.com/dustinspecker/austin#readme","keywords":["austin","powers","spy","test"],"repository":{"type":"git","url":"git+https://github.com/dustinspecker/austin.git"},"author":{"name":"Dustin Specker","email":"DustinSpecker@DustinSpecker.com","url":"github.com/dustinspecker"},"bugs":{"url":"https://github.com/dustinspecker/austin/issues"},"license":"MIT","readmeFilename":"README.md"}