pax_global_header00006660000000000000000000000064132003574650014517gustar00rootroot0000000000000052 comment=6c5b81458211deeb2a55d2fba74b8eaa1d928ee2 lolex-2.2.0/000077500000000000000000000000001320035746500126435ustar00rootroot00000000000000lolex-2.2.0/.bithoundrc000066400000000000000000000003761320035746500150130ustar00rootroot00000000000000{ "critics": { "//": "bitHound only supports running eslint rules greater than 1.0 but lower than 2.0.", "lint": {"engine": "none"} }, "ignore": [ "lolex.js", "script", "**/node_modules/**" ], "test": [ "test/**" ] } lolex-2.2.0/.editorconfig000066400000000000000000000005761320035746500153300ustar00rootroot00000000000000; EditorConfig file: http://EditorConfig.org ; Install the "EditorConfig" plugin into your editor to use root = true [*] charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = space indent_size = 4 trim_trailing_whitespace = true # Matches the exact files either package.json or .travis.yml [{package.json, .travis.yml}] indent_style = space indent_size = 2 lolex-2.2.0/.eslintignore000066400000000000000000000000111320035746500153360ustar00rootroot00000000000000lolex.js lolex-2.2.0/.gitignore000066400000000000000000000000361320035746500146320ustar00rootroot00000000000000/node_modules .DS_Store .idea lolex-2.2.0/.min-wd000066400000000000000000000004471320035746500140440ustar00rootroot00000000000000{ "sauceLabs": true, "browsers": [{ "name": "firefox" }, { "name": "internet explorer", "version": "9", "url": "http://maxantoni.de/doctype.html" }, { "name": "internet explorer", "version": "10" }, { "name": "internet explorer", "version": "11" }] } lolex-2.2.0/.travis.yml000066400000000000000000000011441320035746500147540ustar00rootroot00000000000000language: node_js sudo: false node_js: # https://github.com/nodejs/LTS - "4" # ends April 2018 - "6" # ends April 2019 - "8" # ends December 2019 env: global: - SAUCE_USERNAME=sinonjs - secure: "Szc/biR+MJFC/r4IFzDVXJkIt1COglrCyCd/drmBrXj4AE70J2qn8QlU0n3uQUhrDH5k0NtSWnZHcfxuUTHpasvh9yPFGtqnNeqgftZjXQyJFS+rYye4i04cyYGEmc1qxhpljfAXbvCJV+bHDFmWxIF6KSHWMsVk6IbhoD0/Dis=" script: - "./script/ci-test.sh" - 'if [ "x$TRAVIS_NODE_VERSION" = "x4.2" ]; then npm run lint; fi' - 'if [ "x$TRAVIS_NODE_VERSION" = "x4.2" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then npm run test-cloud; fi' lolex-2.2.0/AUTHORS000066400000000000000000000016761320035746500137250ustar00rootroot00000000000000Carl-Erik Kopseng Christian Johansen Morgan Roderick Maximilian Antoni Mark Wubben Duncan Beevers Soutaro Matsumoto Benjamin Gruenbaum Rogier Schouten Karl O'Keeffe Elad Nachmias Clark Tomlinson Josh Goldberg Andy Edwards Curtis M. Humphrey, Ph.D Edward Betts Kyle Fleming Mark Banner Nando Peter A. Bigot Simen Bekkhus Sylvain Fraïssé Thibault Hild griest024 mAAdhaTTah lolex-2.2.0/History.md000066400000000000000000000125561320035746500146370ustar00rootroot00000000000000 v2.2.0 / 2017-11-07 ================== * Add support for requestAnimationFrame * fix negative timeout bug v2.1.3 / 2017-10-03 ================== * add module entry point (#133) v2.1.2 / 2017-07-25 ================== * - does not fake process.nextTick by default - added .idea folder to .gitignore - fixed documentation - added clock teardowns in tests * overflowing the timer correctly (issue #67) v2.1.1 / 2017-07-19 ================== * support passing parameters in nextTick (fixes #122) v2.1.0 / 2017-07-18 ================== * Throw error on incorrect install use (#112) * Add support for process.nextTick * lolex can now attach itself to the system timers and automatically ad… (#102) * update hrtime when an interval ticks v2.0.0 / 2017-07-13 ================== * New install() signature * Add support for performance.now (#106) * Fix issue with tick(): setSystemClock then throw * Update old dependencies * Added support to automatically increment time (#85) * Changed internal uninstall method signature v1.6.0 / 2017-02-25 =================== * Use common Sinon.JS eslint config * Allow install to be called with date object * Remove wrapper function * Fixed typo in clock.runAll error v1.5.2 / 2016-11-10 =================== * Upgrade mocha to latest * Only overwrite globals when running in IE 1.5.1 / 2016-07-26 ================== * Fix setInterval() behavior with string times * Incorporate test from PR #65 * Fix issue #59: context object required 'process' * fixed a case where runAll was called and there are no timers (#70) * Correct the clear{Interval|Timeout|Immediate} error message when calling `set*` for a different type of timer. * Lots of minor changes to tooling and the build process v1.5.0 / 2016-05-18 =================== * 1.5.0 * Check for existence of `process` before using it * Run to last existing timer * Add runAll method to run timers until empty * Turn off Sauce Labs tests for pull requests * Add tests demonstrating that a fake Date could be created with one argument as a String since this string is in a format recognized by the Date.parse() method. * Run test-cloud on Travis * Add process.hrtime() * Add bithound badge to Readme.md * Make Travis also run tests in node 4.2 * Update jslint, referee, sinon, browserify, mocha, mochify * Rename src/lolex.js to src/lolex-src.js to avoid bithound ignoring it * Add .bithoundrc v1.4.0 / 2015-12-11 =================== * 1.4.0 * Remove BASH syntax in lint script * correct test descriptions to match the tests * correct parseTime() error message so it matches behavior * don't run test-cloud as part of npm test * doc: full API reference * doc: update 'Running tests' section * doc: update 'Faking the native timers' section * doc: remove requestAnimationFrame * Implement clock.next() * Run lint in CI * Fix jslint errors v1.3.2 / 2015-09-22 =================== * 1.3.2 * Fix for breaking shimmed setImmediate v1.3.1 / 2015-08-20 =================== * Remove error whos reason is no longer accurate v1.3.0 / 2015-08-19 =================== * 1.3.0 * Throw exception on wrong use of clearXYZ() * Fix for Sinon.JS issue #808 :add setSystemTime() function * Fix for Sinon.JS issue #766: clearTimeout() no longer clears Immediate/Interval and vice versa * Update Readme.md to point to LICENSE file * Fix error in readme about running tests * Fix for warning about SPDX license format on npm install v1.2.2 / 2015-07-22 =================== * 1.2.2 * Fixing lint mistake * Update travis to use node@0.12 * Fix complaint about missing fake setImmediate * Use license in package.json v1.2.1 / 2015-01-06 =================== * New build * Dodge JSLint... * Up version * Proper fix for writable globals in IE * Make timers writable in old IEs v1.2.0 / 2014-12-12 =================== * 1.2.0 * Fix Sinon.JS issue 624 * Lint the test files also * Add .jslintrc * Delay setImmediate if it is during tick call * Add test case * Test behaviour of hasOwnProperty beforehand * Compare now() with delta * Use undefined for defined predicate * Put setImmediate in toFake list * Capture clock instance for uninstall * Restore commented out tests * Add JSLint verification to test * Configure Travis to run tests in node 0.10.x * Add .editorconfig * Fail when faking Date but not setTimeout/setInterval v1.1.10 / 2014-11-14 ==================== * 1.1.0 Fixes setImmediate problems * Rely on `timer` initialization to null * Timer assembly occurs at addTimer callsites * Sort immediate timers before non-immediate * Add createdAt to timers * Sort timers by multiple criteria, not just callAt * Refactor firstTimerInRange * Rename `timeouts` property to `timers` * addTimer is options-driven v1.0.0 / 2014-11-12 =================== * Add built file for browsers * Fix URL * Don't run tests that require global.__proto__ on IE 9 and IE 10 * Add "bundle" script to create standalone UMD bundle with browserify * Float with new test framework versions * Remove redundant module prefix * Let Browserify set "global" for us * Change test framework from Buster to Mocha and Mochify * Make timer functions independent on `this` * Change APIs according to Readme * Change clock-creating interface * Change Github paths * Basically working extraction from Sinon.JS lolex-2.2.0/LICENSE000066400000000000000000000027571320035746500136630ustar00rootroot00000000000000Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. lolex-2.2.0/RELEASE.md000066400000000000000000000017711320035746500142530ustar00rootroot00000000000000# Rolling Lolex releases You'll need a working installation of [git-extras](https://github.com/tj/git-extras) for this. ## Update Changelog.txt Compile interesting highlights from [`git changelog`](https://github.com/tj/git-extras/blob/master/Commands.md#git-changelog) into Changelog.md git changelog --no-merges ## Update AUTHORS git authors --list > AUTHORS ## Build a new bundle and commit changed files npm run bundle git add lolex.js AUTHORS History.md git commit -m "Prepare for new release" ## Create a new version ``` $ npm version x.y.z ``` Updates package.json and creates a new tag. ## Create a new PR The `master` branch is protected. You can merge it yourself. ## Push new commits and tags ``` git push && git push --tags ``` ## Publish to NPM ``` $ npm publish ``` ## Create a GitHub release Create a GitHub release where you highlight interesting additions from the changelog. Just add a release notes to [the existing tag](https://github.com/sinonjs/lolex/tags). lolex-2.2.0/Readme.md000066400000000000000000000264371320035746500143760ustar00rootroot00000000000000# Lolex [![Build Status](https://secure.travis-ci.org/sinonjs/lolex.png)](http://travis-ci.org/sinonjs/lolex) [![bitHound Overall Score](https://www.bithound.io/github/sinonjs/lolex/badges/score.svg)](https://www.bithound.io/github/sinonjs/lolex) JavaScript implementation of the timer APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, and `clearAnimationFrame`, along with a clock instance that controls the flow of time. Lolex also provides a `Date` implementation that gets its time from the clock. In addition in browser environment lolex provides a `performance` implementation that gets its time from the clock. In Node environments lolex provides a `nextTick` implementation that is synchronized with the clock - and a `process.hrtime` shim that works with the clock. Lolex can be used to simulate passing time in automated tests and other situations where you want the scheduling semantics, but don't want to actually wait (however, from version 2.0 lolex supports those of you who would like to wait too). Lolex is extracted from [Sinon.JS](https://github.com/sinonjs/sinon.js). ## Installation Lolex can be used in both Node and browser environments. Installation is as easy as ```sh npm install lolex ``` If you want to use Lolex in a browser you can use [the pre-built version](https://github.com/sinonjs/lolex/blob/master/lolex.js) available in the repo and the npm package. Using npm you only need to reference `./node_modules/lolex/lolex.js` in your `