{"_id":"mockery","_rev":"161040","name":"mockery","description":"Simplifying the use of mocks with Node.js","dist-tags":{"latest":"2.1.0"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"time":{"modified":"2021-06-03T11:40:13.000Z","created":"2011-10-11T04:44:44.231Z","2.1.0":"2017-06-26T12:25:08.585Z","2.0.0":"2016-10-07T13:01:30.874Z","1.7.0":"2016-05-06T20:35:57.950Z","1.6.2":"2016-04-13T22:08:58.483Z","1.5.1":"2016-04-12T12:59:04.859Z","1.4.1":"2016-03-07T15:21:57.037Z","1.4.0":"2012-12-29T02:19:33.935Z","1.3.0":"2012-12-03T00:38:53.412Z","1.2.0":"2012-09-16T22:51:09.195Z","1.1.2":"2012-04-08T01:53:17.059Z","1.1.1":"2011-12-27T05:38:28.478Z","1.0.1":"2011-11-17T17:01:36.883Z","1.0.0":"2011-10-11T04:44:44.231Z"},"users":{"sandeepmistry":true,"cybo42":true,"jamescostian":true,"wayneseymour":true,"hal9zillion":true,"miles.rout":true,"koulmomo":true,"bzb-stcnx":true,"joakin":true,"subchen":true,"tobiasnickel":true,"nickeltobias":true,"carsy":true,"jahnestacado":true,"gregl83":true,"princetoad":true,"dmdnkv":true,"mike.goodwin":true,"fenyot":true,"monolithed":true,"kaapex":true,"456wyc":true,"highflying":true,"deneboulton":true,"carlosvillademor":true,"rsp":true,"zazaian":true,"jonhermansen":true},"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"versions":{"2.1.0":{"name":"mockery","version":"2.1.0","description":"Simplifying the use of mocks with Node.js","keywords":["mock","stub","require","module","cache","unit","test","unittest","testing","tdd"],"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"},{"name":"Dav Glass","email":"davglass@gmail.com"}],"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","dependencies":{},"jshintConfig":{"node":true},"devDependencies":{"istanbul":"~0.3.5","jshint":"~2.6.0","sinon":"1.2.x","unix-dgram":"^0.2.3","vows":"~0.8.1"},"scripts":{"pretest":"jshint mockery.js ./test/*.js","test":"istanbul cover --print both -- vows --spec ./test/*.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"gitHead":"822f0566fd6d72af8c943ae5ca2aa92e516aa2cf","homepage":"https://github.com/mfncooper/mockery#readme","_id":"mockery@2.1.0","_npmVersion":"5.0.3","_nodeVersion":"6.10.3","_npmUser":{"name":"davglass","email":"davglass@gmail.com"},"dist":{"shasum":"5b0aef1ff564f0f8139445e165536c7909713470","size":11708,"noattachment":false,"key":"/mockery/-/mockery-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-2.1.0.tgz"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mockery-2.1.0.tgz_1498479907519_0.5037881978787482"},"directories":{},"publish_time":1498479908585,"_cnpm_publish_time":1498479908585,"_hasShrinkwrap":false},"2.0.0":{"name":"mockery","version":"2.0.0","description":"Simplifying the use of mocks with Node.js","keywords":["mock","stub","require","module","cache","unit","test","unittest","testing","tdd"],"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"},{"name":"Dav Glass","email":"davglass@gmail.com"}],"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","dependencies":{},"jshintConfig":{"node":true},"devDependencies":{"istanbul":"~0.3.5","jshint":"~2.6.0","sinon":"1.2.x","unix-dgram":"^0.2.3","vows":"~0.8.1"},"scripts":{"pretest":"jshint mockery.js ./test/*.js","test":"istanbul cover --print both -- vows --spec ./test/*.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"gitHead":"ad2d72710c6ac433bb9ee24680acbfaf7ef03f63","homepage":"https://github.com/mfncooper/mockery","_id":"mockery@2.0.0","_shasum":"0569a11a1848461fdc347cf8cca2df2f3129bc03","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.7.0","_npmUser":{"name":"davglass","email":"davglass@gmail.com"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"dist":{"shasum":"0569a11a1848461fdc347cf8cca2df2f3129bc03","size":11706,"noattachment":false,"key":"/mockery/-/mockery-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-2.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/mockery-2.0.0.tgz_1475845288268_0.2694637014064938"},"directories":{},"publish_time":1475845290874,"_cnpm_publish_time":1475845290874,"_hasShrinkwrap":false},"1.7.0":{"name":"mockery","version":"1.7.0","description":"Simplifying the use of mocks with Node.js","keywords":["mock","stub","require","module","cache","unit","test","unittest","testing","tdd"],"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"},{"name":"Dav Glass","email":"davglass@gmail.com"}],"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","dependencies":{},"jshintConfig":{"node":true},"devDependencies":{"istanbul":"~0.3.5","jshint":"~2.6.0","sinon":"1.2.x","unix-dgram":"^0.2.3","vows":"~0.8.1"},"scripts":{"pretest":"jshint mockery.js ./test/*.js","test":"istanbul cover --print both -- vows --spec ./test/*.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"gitHead":"4feec5dd1340163ffea5de1135d37c753a071f19","homepage":"https://github.com/mfncooper/mockery","_id":"mockery@1.7.0","_shasum":"f4ede0d8750c1c9727c272ea2c60629e2c9a1c4f","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.4","_npmUser":{"name":"davglass","email":"davglass@gmail.com"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"dist":{"shasum":"f4ede0d8750c1c9727c272ea2c60629e2c9a1c4f","size":11541,"noattachment":false,"key":"/mockery/-/mockery-1.7.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.7.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/mockery-1.7.0.tgz_1462566956296_0.7034751276951283"},"directories":{},"publish_time":1462566957950,"_cnpm_publish_time":1462566957950,"_hasShrinkwrap":false},"1.6.2":{"name":"mockery","version":"1.6.2","description":"Simplifying the use of mocks with Node.js","keywords":["mock","stub","require","module","cache","unit","test","unittest","testing","tdd"],"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"},{"name":"Dav Glass","email":"davglass@gmail.com"}],"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","dependencies":{},"jshintConfig":{"node":true},"devDependencies":{"istanbul":"~0.3.5","jshint":"~2.6.0","sinon":"1.2.x","vows":"~0.8.1"},"scripts":{"pretest":"jshint mockery.js ./test/*.js","test":"istanbul cover --print both -- vows --spec ./test/*.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"gitHead":"ed8f094a764abf6d9e936ca1bdd9e5de53ea3622","homepage":"https://github.com/mfncooper/mockery#readme","_id":"mockery@1.6.2","_shasum":"3710cef3d92d2c782c5991d297dffd6903f6f618","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"davglass","email":"davglass@gmail.com"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"dist":{"shasum":"3710cef3d92d2c782c5991d297dffd6903f6f618","size":11053,"noattachment":false,"key":"/mockery/-/mockery-1.6.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.6.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/mockery-1.6.2.tgz_1460585336210_0.4777009626850486"},"directories":{},"publish_time":1460585338483,"_cnpm_publish_time":1460585338483,"_hasShrinkwrap":false},"1.5.1":{"name":"mockery","version":"1.5.1","description":"Simplifying the use of mocks with Node.js","keywords":["mock","stub","require","module","cache","unit","test","unittest","testing","tdd"],"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"},{"name":"Dav Glass","email":"davglass@gmail.com"}],"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","dependencies":{},"jshintConfig":{"node":true},"devDependencies":{"istanbul":"~0.3.5","jshint":"~2.6.0","sinon":"1.2.x","vows":"~0.8.1"},"scripts":{"pretest":"jshint mockery.js ./test/*.js","test":"istanbul cover --print both -- vows --spec ./test/*.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"gitHead":"48b23aa7fd91c74ec8635e9318a9bf57ab465bd8","homepage":"https://github.com/mfncooper/mockery#readme","_id":"mockery@1.5.1","_shasum":"37be5e2b523e3b0ff037b8666aeef1adf8243264","_from":".","_npmVersion":"2.14.20","_nodeVersion":"4.4.0","_npmUser":{"name":"davglass","email":"davglass@gmail.com"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"dist":{"shasum":"37be5e2b523e3b0ff037b8666aeef1adf8243264","size":11042,"noattachment":false,"key":"/mockery/-/mockery-1.5.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.5.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/mockery-1.5.1.tgz_1460465943373_0.05144573003053665"},"directories":{},"publish_time":1460465944859,"_cnpm_publish_time":1460465944859,"_hasShrinkwrap":false},"1.4.1":{"name":"mockery","version":"1.4.1","description":"Simplifying the use of mocks with Node.js","keywords":["mock","stub","require","module","cache","unit","test","unittest","testing","tdd"],"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"},{"name":"Dav Glass","email":"davglass@gmail.com"}],"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","dependencies":{},"jshintConfig":{"node":true},"devDependencies":{"istanbul":"~0.3.5","jshint":"~2.6.0","sinon":"1.2.x","vows":"~0.8.1"},"scripts":{"pretest":"jshint mockery.js ./test/*.js","test":"istanbul cover --print both -- vows --spec ./test/*.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"gitHead":"b6612a1916be4bf767809717e1a9e597cc72cb0b","homepage":"https://github.com/mfncooper/mockery","_id":"mockery@1.4.1","_shasum":"e8cff1f19049aa94aad0bb0ba13af256f11b1dbe","_from":".","_npmVersion":"2.14.9","_nodeVersion":"0.12.10","_npmUser":{"name":"davglass","email":"davglass@gmail.com"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"dist":{"shasum":"e8cff1f19049aa94aad0bb0ba13af256f11b1dbe","size":10884,"noattachment":false,"key":"/mockery/-/mockery-1.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.4.1.tgz"},"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/mockery-1.4.1.tgz_1457364115439_0.9432483683340251"},"directories":{},"publish_time":1457364117037,"_cnpm_publish_time":1457364117037,"_hasShrinkwrap":false},"1.4.0":{"name":"mockery","version":"1.4.0","description":"Simplifying the use of mocks with Node.js","keywords":["mock","stub","require","module","cache","unit","test","unittest","testing","tdd"],"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"}],"repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","engines":{"node":">=0.4.5"},"dependencies":{},"devDependencies":{"nodeunit":"0.6.x","sinon":"1.2.x"},"scripts":{"test":"test/run.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"readmeFilename":"README.md","_id":"mockery@1.4.0","dist":{"shasum":"81decc794e14a8b609d2ae218c91d6723367de2f","size":8872,"noattachment":false,"key":"/mockery/-/mockery-1.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.4.0.tgz"},"_npmVersion":"1.1.69","_npmUser":{"name":"mfncooper","email":"mfncooper@gmail.com"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"directories":{},"publish_time":1356747573935,"_cnpm_publish_time":1356747573935,"_hasShrinkwrap":false},"1.3.0":{"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"}],"name":"mockery","description":"Simplifying the use of mocks with Node.js","version":"1.3.0","repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","engines":{"node":">=0.4.5"},"dependencies":{},"devDependencies":{"nodeunit":"0.6.x","sinon":"1.2.x"},"scripts":{"test":"test/run.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"_id":"mockery@1.3.0","dist":{"shasum":"efb2a827447cadcc57909a63565d3f1afae1bfce","size":7993,"noattachment":false,"key":"/mockery/-/mockery-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.3.0.tgz"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"directories":{},"publish_time":1354495133412,"_cnpm_publish_time":1354495133412,"_hasShrinkwrap":false},"1.2.0":{"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"}],"name":"mockery","description":"Simplifying the use of mocks with Node.js","version":"1.2.0","repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","engines":{"node":">=0.4.5"},"dependencies":{},"devDependencies":{"nodeunit":"0.6.x","sinon":"1.2.x"},"scripts":{"test":"test/run.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"_id":"mockery@1.2.0","dist":{"shasum":"db191b59577163efc5e335e69502d6c4667219b3","size":7208,"noattachment":false,"key":"/mockery/-/mockery-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.2.0.tgz"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"directories":{},"publish_time":1347835869195,"_cnpm_publish_time":1347835869195,"_hasShrinkwrap":false},"1.1.2":{"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"}],"name":"mockery","description":"Simplifying the use of mocks with Node.js","version":"1.1.2","repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","engines":{"node":">=0.4.5"},"dependencies":{},"devDependencies":{"nodeunit":"0.6.x","sinon":"1.2.x"},"scripts":{"test":"test/run.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"_npmUser":{"name":"mfncooper","email":"mfncooper@gmail.com"},"_id":"mockery@1.1.2","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"036abe0233d9ac904a33f84ff97a1468e01a5cda","size":6915,"noattachment":false,"key":"/mockery/-/mockery-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.1.2.tgz"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"directories":{},"publish_time":1333849997059,"_cnpm_publish_time":1333849997059,"_hasShrinkwrap":false},"1.1.1":{"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"contributors":[{"name":"Bryan Donovan","email":"bdondo@gmail.com"}],"name":"mockery","description":"Simplifying the use of mocks with Node.js","version":"1.1.1","repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","engines":{"node":">=0.4.5"},"dependencies":{},"devDependencies":{"nodeunit":"0.6.x","sinon":"1.2.x"},"scripts":{"test":"test/run.js"},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"_npmUser":{"name":"mfncooper","email":"mfncooper@gmail.com"},"_id":"mockery@1.1.1","_engineSupported":true,"_npmVersion":"1.1.0-alpha-2","_nodeVersion":"v0.6.3","_defaultsLoaded":true,"dist":{"shasum":"cc7cd8072be99ef0b33205760e4f5f886181e3e5","size":6071,"noattachment":false,"key":"/mockery/-/mockery-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.1.1.tgz"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"directories":{},"publish_time":1324964308478,"_cnpm_publish_time":1324964308478,"_hasShrinkwrap":false},"1.0.1":{"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"name":"mockery","description":"Simplifying the use of mocks with Node.js","version":"1.0.1","repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","engines":{"node":">=0.4.5"},"dependencies":{},"devDependencies":{},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"_npmUser":{"name":"mfncooper","email":"mfncooper@gmail.com"},"_id":"mockery@1.0.1","_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"ac04f70f2a85ecd35b563f7fdda54e01407daf7e","size":10240,"noattachment":false,"key":"/mockery/-/mockery-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.0.1.tgz"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"directories":{},"publish_time":1321549296883,"_cnpm_publish_time":1321549296883,"_hasShrinkwrap":false},"1.0.0":{"author":{"name":"Martin Cooper","email":"mfncooper@gmail.com"},"name":"mockery","description":"Simplifying the use of mocks with Node.js","version":"1.0.0","repository":{"type":"git","url":"git://github.com/mfncooper/mockery.git"},"bugs":{"url":"http://github.com/mfncooper/mockery/issues"},"main":"mockery.js","engines":{"node":">=0.4.5"},"dependencies":{},"devDependencies":{},"licenses":[{"type":"MIT","url":"http://github.com/mfncooper/mockery/raw/master/LICENSE"}],"_npmUser":{"name":"mfncooper","email":"mfncooper@gmail.com"},"_id":"mockery@1.0.0","_engineSupported":true,"_npmVersion":"1.0.94","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"4459632080be9ed03fd7bdc1edcf76d96fb15b87","size":10240,"noattachment":false,"key":"/mockery/-/mockery-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mockery/download/mockery-1.0.0.tgz"},"maintainers":[{"name":"davglass","email":"davglass@gmail.com"},{"name":"gotwarlost","email":"kananthmail-github@yahoo.com"},{"name":"mfncooper","email":"mfncooper@gmail.com"}],"directories":{},"publish_time":1318308284231,"_cnpm_publish_time":1318308284231,"_hasShrinkwrap":false}},"readme":"# Mockery - Simplifying the use of mocks with Node.js\n\n[![Build Status](https://secure.travis-ci.org/mfncooper/mockery.svg)](http://travis-ci.org/mfncooper/mockery)\n\nIf you've tried working with mocks in Node.js, you've no doubt discovered that\nit's not so easy to get your mocks hooked up in the face of Node's module\nloading system. When your source-under-test pulls in its dependencies through\n`require`, you want your mocks provided, instead of the original module,\nto enable true unit testing of your code.\n\nThis is exactly the problem Mockery is designed to solve. Mockery gives you a\nsimple and easy to use API with which you can hook in your mocks without having\nto get your hands dirty with the `require` cache or other Node implementation\ndetails.\n\nMockery is *not* a mocking framework. It lets you work more easily with your\nframework of choice (or no framework) to get your mocks hooked in to all the\nright places in the code you need to test.\n\n* [Installation](#installation)\n* [Enabling mockery](#enabling-mockery)\n* [Registering mocks](#registering-mocks)\n* [Registering substitutes](#registering-substitutes)\n* [Registering allowable modules](#registering-allowable-modules)\n* [Deregistering everything](#deregistering-everything)\n* [Controlling the module cache](#controlling-the-module-cache)\n* [Disabling warnings](#disabling-warnings)\n* [The name](#the-name)\n* [License](#license)\n\n## Installation\n\nJust use npm:\n\n    npm install mockery\n\n## Enabling mockery\n\nWhen enabled, Mockery intercepts *all* `require` calls, regardless of where\nthose calls are being made from. Thus it's almost always desirable to bracket\nyour usage as narrowly as possible.\n\nIf you're using a typical unit testing framework, you might enable and disable\nMockery in the test setup and teardown functions for your test cases. Something\nlike this:\n\n    setUp: function() {\n        mockery.enable();\n    },\n    tearDown: function() {\n        mockery.disable();\n    }\n\n### Options\n\nYou can set up some initial configuration by passing an options object to\n`enable`. Omitting the options object, or any of the defined keys, causes the\nstandard defaults to be used.\n\nFor example, to disable all warnings, you might use this:\n\n    mockery.enable({\n        warnOnReplace: false,\n        warnOnUnregistered: false\n    });\n\nThe available options are:\n\n* _useCleanCache_ determines whether a temporary module cache should be used\nwhile Mockery is enabled. See [Controlling the module cache](#controlling-the-module-cache)\nbelow. [Default: false]\n* _warnOnReplace_ determines whether or not warnings are issued when a mock or\nsubstitute is replaced without being first deregistered. This has the same\neffect as the `warnOnReplace` function. [Default: true]\n* _warnOnUnregistered_ determines whether or not warnings are issued when a\nmodule is not mocked, substituted or allowed. This has the same effect as the\n`warnOnUnregistered` function. [Default: true]\n\n## Registering mocks\n\nYou register your mocks with Mockery to tell it which mocks to provide for which\n`require` calls. For example:\n\n    var fsMock = {\n        stat: function (path, cb) { /* your mock code */ }\n    };\n    mockery.registerMock('fs', fsMock);\n\nThe arguments to `registerMock` are as follows:\n\n* _module_, the name or path of the module for which a mock is being\nregistered. This must exactly match the argument to `require`; there is no\n\"clever\" matching.\n* _mock_, the mock to be provided. Whatever is provided here is what will\nbecome the result of subsequent `require` calls; that is, the `exports` of the\nmodule.\n\nIf you no longer want your mock to be used, you can deregister it:\n\n    mockery.deregisterMock('fs');\n\nNow the original module will be provided for any subsequent `require` calls.\n\n## Registering substitutes\n\nSometimes you want to implement your mock itself as a module, especially if it's\nmore complicated and you'll be reusing it more widely. In that case, you can\ntell Mockery to substitute that module for the original one. For example:\n\n    mockery.registerSubstitute('fs', 'fs-mock');\n\nNow any `require` invocation for 'fs' will be satisfied by loading the 'fs-mock'\nmodule instead.\n\nThe arguments to `registerSubstitute` are as follows:\n\n* _module_, the name or path of the module for which a substitute is being\nregistered. This must exactly match the argument to `require`; there is no\n\"clever\" matching.\n* _substitute_, the name or path of the module to substitute for _module_.\n\nIf you no longer want your substitute to be used, you can deregister it:\n\n    mockery.deregisterSubstitute('fs');\n\nNow the original module will be provided for any subsequent `require` calls.\n\n## Registering allowable modules\n\nIf you enable Mockery and _don't_ mock or substitute a module that is later\nloaded via `require`, Mockery will print a warning to the console to tell you\nthat. This is so that you don't inadvertently use downstream modules without\nbeing aware of them. By registering a module as \"allowable\", you tell Mockery\nthat you know about its use, and then Mockery won't print the warning.\n\nThe most common use case for this is your source-under-test, which obviously\nyou'll want to load without warnings. For example:\n\n    mockery.registerAllowable('./my-source-under-test');\n\nAs with `registerMock` and `registerSubstitute`, the first argument, _module_,\nis the name or path of the module as it would be provided to `require`. Once\nagain, you can deregister it if you need to:\n\n    mockery.deregisterAllowable('./my-source-under-test');\n\nSometimes you'll find that you need to register several modules at once. A\nconvenience function lets you do this with a single call:\n\n    mockery.registerAllowables(['async', 'path', 'util']);\n\nand similarly to deregister several modules at once, as you would expect:\n\n    mockery.deregisterAllowables(['async', 'path', 'util']);\n\n### Unhooking\n\nBy default, the Node module loader will load a given module only once, caching\nthe loaded module for the lifetime of the process. When you're using Mockery,\nthis is almost always what you want. _Almost_. In relatively rare situations,\nyou may find that you need to use different mocks for different test cases\nfor the same source-under-test. (This is not the same as supplying different\ntest data in the same mock; here we're talking about providing different\nfunctions for a module's `exports`.)\n\nTo do this, your source-under-test must be unhooked from Node's module loading\nsystem, such that it can be loaded again with new mocks. You do this by passing\na second argument, _unhook_, to `registerAllowable`, like this:\n\n    mockery.registerAllowable('./my-source-under-test', true);\n\nWhen you subsequently deregister your source-under-test, Mockery will unhook it\nfrom the Node module loading system as well as deregistering it.\n\n## Deregistering everything\n\nSince it's such a common use case, especially when you're using a unit test\nframework and its setup and teardown functions, Mockery provides a convenience\nfunction to deregister everything:\n\n    mockery.deregisterAll();\n\nThis will deregister all mocks, substitutes, and allowable modules, as well as\nunhooking any hooked modules.\n\n## Controlling the module cache\n\nOne of the common problems that people encounter when trying to use mocks in\nNode is that modules and their exports are almost always cached. This makes it\ndifficult to plug in a mock for testing if the module being mocked has already\nbeen loaded elsewhere.\n\nMockery provides a way for you to run your tests using a clean module cache, as\nif no modules have been loaded. When this option is enabled, any previously\nloaded modules will be \"forgotten\", and `require` calls will cause them to be\nreloaded. This in turn allows your mocks to be picked up, and your tests to run\nas expected.\n\nYou tell Mockery to use a clean cache when you enable it, like this:\n\n    mockery.enable({ useCleanCache: true });\n\nNow all modules will be cached in this new clean cache, until you later disable\nMockery again. The new cache is temporary, and is discarded when Mockery is\ndisabled. The original cache is reinstated at that point, so you are back to\nwhere you were before enabling the clean cache option.\n\nWhile you are working with a temporary cache, it may occasionally be useful to\nreset it to a clean state again, without disabling and re-enabling Mockery. You\ncan do this with:\n\n    mockery.resetCache();\n\nThis function has no effect if the clean cache option is not already in use.\n\n## Disabling warnings\n\nAs mentioned above, if you enable Mockery and _don't_ mock, substitute, or\nallow a module that is later loaded, Mockery will print a warning to the\nconsole to tell you that. This is important when you're writing unit tests,\nso that you don't end up using modules you weren't aware of.\n\nIn certain circumstances, such as when writing functional or integration tests,\nyou may find it irritating to have to allow each module or to have all the\nwarnings appear on the console. If you need to, you can tell Mockery to turn\noff those warnings:\n\n    mockery.warnOnUnregistered(false);\n\nMockery will also print a warning to the console whenever you register a mock\nor substitute for a module for which one is already registered. This is almost\nalways what you want, since you should be deregistering mocks and substitutes\nthat you no longer need. Occasionally, though, you may want to suppress these\nwarnings, which you can do like this:\n\n    mockery.warnOnReplace(false);\n\nIn either of these cases, if you later need to re-enable the warnings, then\npassing `true` to the same functions will do that, as you might imagine.\n\n## The name\n\nMockery is to mocks as rookery is to rooks.\n\n## License\n\nMockery is licensed under the [MIT License](http://github.com/mfncooper/mockery/raw/master/LICENSE).\n","_attachments":{},"homepage":"https://github.com/mfncooper/mockery#readme","bugs":{"url":"http://github.com/mfncooper/mockery/issues"}}