{"_id":"timerstub","_rev":"24-edd8da465518114f868cad2e63bfab03","name":"timerstub","description":"Stubbed out timer objects for testing","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"0.1.0","repository":{"url":""},"main":"index.js","engines":{"node":"~0.4"},"scripts":{"test":"nodeunit test.coffee"},"dependencies":{"nodeunit":"~0.5","coffee-script":"~1.1.2"},"devDependencies":{},"_npmJsonOpts":{"file":"/Users/josephg/.npm/timerstub/0.1.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"timerstub@0.1.0","_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"34e2386a369c32d59d5500cf1ac9e211ab57c86b","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-0.1.0.tgz","integrity":"sha512-2dnGnkGH7gPhp6fj59dR2vOVOgytxEr1bAwVRvThItpSKctESdgXUBcJb3fCTBg2+1oIH5AA0waWjoT1jfuBLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICih5aOx2sfl8nbj709/u68WPR69WTiYpfrp/7chb9N5AiEAuO9OzaHMo3Tgj30RwzhZ4j3aWjfcvqvyDsWNzeJAxzU="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"directories":{}},"0.1.1":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"0.1.1","repository":{"url":""},"main":"index.js","engines":{"node":"~0.4"},"scripts":{"test":"nodeunit test.coffee"},"dependencies":{"coffee-script":"~1.1.2"},"devDependencies":{"nodeunit":"~0.5"},"_npmJsonOpts":{"file":"/Users/josephg/.npm/timerstub/0.1.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"timerstub@0.1.1","_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"de66f4e924be424da584ee7fea187657cdfce135","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-0.1.1.tgz","integrity":"sha512-TZ1+JGbp7ORrEO5GYLyqb+XNoKTuEGlmnzLH6YK8jOLutZ1GOnwqxMdqUmhxGuNRWuIww26IDWO4+/nsMzS9XA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFKhffvulMZeXZsEEX1JQlUdQtHwN9BG6oSFBvtVqhwOAiEAkM+hpjuPHZSX4F6kzpJi2mym4BXhzElKxZkwoHOXeyA="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"directories":{}},"0.1.2":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"0.1.2","repository":{"url":""},"main":"index.js","engines":{"node":"~0.4"},"scripts":{"test":"nodeunit test.coffee"},"dependencies":{"coffee-script":"~1.1.2"},"devDependencies":{"nodeunit":"~0.5"},"_npmJsonOpts":{"file":"/Users/josephg/.npm/timerstub/0.1.2/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"timerstub@0.1.2","_engineSupported":true,"_npmVersion":"1.0.15","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"5f99600259e3e0252c9d68c3f05863b86622e73b","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-0.1.2.tgz","integrity":"sha512-BTgRaJLTZtB4yyTEKJszDgeERd4o9pSuwNJ4QB3tO7QdBtb+Ay0tUB/pRJo+zMVoZ/JCIKMkB/o0aamrXYaSeg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEGoIVS5hKrVWIr9S7nYAni5lNQZ7z0DjvjQtWvx9SELAiEAtpSSRZo2xGS+z2754VLCIORiFAVqU3FUmvczmrdCnqo="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"directories":{}},"0.1.3":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"0.1.3","repository":{"url":""},"main":"index.js","engines":{"node":"*"},"scripts":{"test":"nodeunit test.coffee"},"dependencies":{"coffee-script":"~1.1.2"},"devDependencies":{"nodeunit":"~0.5"},"_npmUser":{"name":"josephg","email":"josephg@gmail.com"},"_id":"timerstub@0.1.3","_engineSupported":true,"_npmVersion":"1.0.98","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"d31b32a9774a181a9294a60b8a9698b1b1eb3708","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-0.1.3.tgz","integrity":"sha512-v1Q5J+pWDbdyLP4xrc0784rJh4NWyHbJmp+Lv/L+pl9kQI3wLxc3ub57UGyYWU15L7sOflcRrIeEoJfR4NPu5A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClPsZNjFxtKnllkWa9XD9yWEVHdAEWaj13R8S9Sm2x7gIgSk3KCA+wxK1iKWV9Iu3sGAQePx8q06HTDkfJtP6Gwq0="}]},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"directories":{}},"1.0.0":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"1.0.0","repository":{"url":""},"main":"index.js","engines":{"node":"~0.8"},"scripts":{"test":"nodeunit test.coffee"},"dependencies":{"coffee-script":"~1"},"devDependencies":{"nodeunit":"*"},"_id":"timerstub@1.0.0","dist":{"shasum":"be994fea135a2710093fff1479cf9877f7db5b4a","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-1.0.0.tgz","integrity":"sha512-AlfzMwu9x7QT0ndg9i8zhRxCHfozCkokVZoyCfrzaM5sxl82xs4dRzbWmmOUZ1pDpIi/3verX45AzR7nvqfieg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFYkPn18FRGpkx/8sDct/sXSUEy3LnigWbh2fxjOScEkAiEAyGbIP+q0N0vUOasrA/7qr5XgzhmjmiAH3O+sdd0/kPw="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"josephg","email":"josephg@gmail.com"},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"directories":{}},"1.0.1":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"1.0.1","repository":{"url":""},"main":"index.js","engines":{"node":"~0.10"},"scripts":{"test":"nodeunit test.coffee"},"dependencies":{"coffee-script":"~1"},"devDependencies":{"nodeunit":"*"},"_id":"timerstub@1.0.1","dist":{"shasum":"2d4e8bf3c5ea30bff6683b4b9ab42557f30b12cb","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-1.0.1.tgz","integrity":"sha512-n0GIp+5ZJR2lqsHAfaBbIXx3ttx0mAVCuzefoDSHY/iHbQoSvSlLMvMNILFCVSIVj8qAB1DqLWuA8z2lnjdrqw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCD/8AwJn/7/pJ3nlOgJXhoO+4Wk93CgzIbSIRzuukexQIgELf8eYQcEhikDOAhefKs6mLIizsXeHzOUWjYC5YSgJs="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"josephg","email":"josephg@gmail.com"},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}]},"1.0.2":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"1.0.2","repository":{"url":""},"main":"timers.js","engines":{"node":"~0.10"},"scripts":{"prepublish":"make","test":"nodeunit test.coffee"},"dependencies":{},"devDependencies":{"coffee-script":"~1","nodeunit":"*"},"_id":"timerstub@1.0.2","dist":{"shasum":"2785d757dc0e06eb0d24d5b637b255b0bdcd3e61","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-1.0.2.tgz","integrity":"sha512-2e22B3KGBLuRUEs3uHjhNuCqAI5kARN4tO58E9uhpBy/dXnQCP2jUiRyYdThjgTW33GjiSl4toZu4zKKVljaGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCFS53FNxuZcKnyLQwl0MKGOECOEXTe+goRTITnGfcMIAIgFGgU6j60SlcmC9yjYlIJHU9G8UMjeLqXO2jOCMFwa7Y="}]},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"josephg","email":"josephg@gmail.com"},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}]},"1.0.3":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"1.0.3","repository":{"type":"git","url":"https://github.com/josephg/node-timerstub.git"},"main":"timers.js","engines":{"node":"~0.10"},"scripts":{"test":"mocha --compilers coffee:coffee-script/register --reporter spec test.coffee"},"dependencies":{},"devDependencies":{"coffee-script":"~1","mocha":"*"},"bugs":{"url":"https://github.com/josephg/node-timerstub/issues"},"homepage":"https://github.com/josephg/node-timerstub","_id":"timerstub@1.0.3","dist":{"shasum":"38e33fc7fc7f24a0c83973fe47499d9ca3bddc09","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-1.0.3.tgz","integrity":"sha512-i2z1G0jwf9OkFBPAEAC/E+hYhN+PViu9D7WrauBbRgxaFWvlkXJ7+rdzzHijz+zlFNgkuhN7KVhw7ochWm6cKw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBJf5WpF22PKhXLNJOmO8bobKCQhNf0azkhLG3miLGgKAiBzh07Vnr7n23uQ5WGocGfunK674zt+xgv4mZ+MMEHudA=="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"josephg","email":"me@josephg.com"},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}]},"1.1.0":{"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"name":"timerstub","description":"Stubbed out timer objects for testing","keywords":["test","stub","timeout","time"],"version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/josephg/node-timerstub.git"},"main":"timers.js","engines":{"node":"~0.10"},"scripts":{"test":"mocha --compilers coffee:coffee-script/register --reporter spec test.coffee"},"dependencies":{},"devDependencies":{"coffee-script":"~1","mocha":"*"},"gitHead":"4920e7d487a1007ae2ced38a65a9996dcc1dc320","bugs":{"url":"https://github.com/josephg/node-timerstub/issues"},"homepage":"https://github.com/josephg/node-timerstub#readme","_id":"timerstub@1.1.0","_shasum":"f642f30eda7464efa32ba8dc014a102de02ea372","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"josephg","email":"me@josephg.com"},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"dist":{"shasum":"f642f30eda7464efa32ba8dc014a102de02ea372","tarball":"https://registry.npmjs.org/timerstub/-/timerstub-1.1.0.tgz","integrity":"sha512-QCwG3Uu+WEYBOtxltzp6Nniu0FmkO7Hw+d1K5Leg6OsbwrBGRVb3DfDijlwZudZ/rK+dLUlEcDrGuwIPKodHfQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCV56/Gs0Pkbje/I2nyRXEhRjhli7ahJ3Sx5dHdGvB0+wIgELyd7+JtLGaKtQf+H1I+nV7KQJrpLS9Z0PPIU8XUtjE="}]}}},"maintainers":[{"name":"josephg","email":"josephg@gmail.com"}],"time":{"modified":"2022-06-27T06:50:24.919Z","created":"2011-09-30T14:43:53.054Z","0.1.0":"2011-09-30T14:43:54.674Z","0.1.1":"2011-09-30T23:39:30.512Z","0.1.2":"2011-10-02T03:43:04.234Z","0.1.3":"2011-11-20T04:27:11.448Z","1.0.0":"2012-12-03T02:17:21.517Z","1.0.1":"2013-03-21T19:36:09.634Z","1.0.2":"2013-05-19T20:55:47.937Z","1.0.3":"2014-06-15T16:56:23.713Z","1.1.0":"2015-08-22T01:05:22.015Z"},"author":{"name":"Joseph Gentle","email":"josephg@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/josephg/node-timerstub.git"},"readme":"# Timer stub\n\nThis is a super simple library to stub out the default javascript timer methods\nwith something that doesn't take any actual time to run. Because slow tests are\nfor suckers!\n\nIf you're writing a library which uses timers (like\n    [node-browserchannel](https://github.com/josephg/node-browserchannel)), its\nannoying to wait 30 seconds for your timeout event to fire.\n\n## Install it\n\n```\nnpm install timerstub\n```\n\nAdd it to your package.json:\n\n```json\n  \"dependencies\": {\n    \"timerstub\": \"*\"\n  }\n```\n\n\n## Use it\n\nTimer stub provides a replacement version of `setInterval`, `clearInterval`,\n`setTimeout`, `clearTimeout` and `Date.now` (through a wrapped `Date`\nfunction).\n\nInstead of needing to spend real time waiting for your queued methods to be\ncalled, you can now just call `timerstub.wait 1000, -> done()` to 'wait' 1000\nmilliseconds. Any queued intervals and timeouts will be called (in order)\nbefore your callback is called. Oh yeah, and `Date.now()` will return the\nright values in all the callbacks. As far as your library is concerned, 1000\nmilliseconds *have really passed*. But your test runs as fast as your CPU can\nmanage it.\n\n\n## Example to copy+paste\n\nIn your library, write something like this:\n\n```javascript\nvar setInterval, clearInterval, setTimeout, clearTimeout, Date;\nfunction setTimeFunctions(source) {\n  setInterval = source.setInterval;\n  clearInterval = source.clearInterval;\n  setTimeout = source.setTimeout;\n  clearTimeout = source.clearTimeout;\n  Date = source.Date;\n};\nsetTimeFunctions((function() { return this; })()); // Use the normal ones.\nexports.setTimeFunctions = setTimeFunctions;\n\n\n// ... Then write the rest of your code as normal.\nexports.coolstuff = function() {\n\tvar timer = setTimeout(function() { foo(); }, 1000);\n\tvar start = new Date();\n\ttime = Date.now();\n\tclearTimeout(timer);\n  // ...\n}\n```\n\nIn a testing framework like mocha:\n\n```coffeescript\ntimerstub = require 'timerstub'\nassert = require 'assert'\nmycoollibrary = require './mycoollibrary'\n\nmycoollibrary.setTimeFunctions timerstub\n\ndescribe 'my cool thing'\n\tbeforeEach ->\n\t\ttimerstub.clearAll() # This removes all queued timeouts and whatnot\n\n\tit 'does cool stuff': (done) ->\n\t\tmycoollibrary.coolstuff()\n\t\ttimerstub.wait 1000, ->\n\t\t\t# Now 1000 milliseconds of setInterval calls and stuff have run... instantly!\n\t\t\tassert.strictEqual you.sexy, true\n\t\t\tdone()\n```\n\nIn a parallel testing framework like expresso, simply add a call to\n`timerstub.waitAll()` after all your tests have been scheduled. (In\nexpresso, that would be in a `beforeExit` block).\n\ntesttimers should be compatible with all the testing frameworks - it doesn't\ninterfere with the testing framework at all.\n\n\n---\n\n## MIT Licensed\n\nLicensed under the standard MIT license:\n\nCopyright 2011 Joseph Gentle.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","homepage":"https://github.com/josephg/node-timerstub#readme","keywords":["test","stub","timeout","time"],"bugs":{"url":"https://github.com/josephg/node-timerstub/issues"},"readmeFilename":"README.md"}