Skip to content

Commit

Permalink
Add lolexFromGlobal export
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 8, 2018
1 parent 13357ef commit 6b3b127
Show file tree
Hide file tree
Showing 3 changed files with 654 additions and 677 deletions.
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ Implements the `Date` object but using the clock to provide the correct time.

Implements the `now` method of the [`Performance`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) object but using the clock to provide the correct time. Only available in environments that support the Performance object (browsers mostly).

### `lolex.withGlobal`

In order to support creating clocks based on separate or sandboxed environments (such as JSDOM), Lolex exports a factory method which takes single argument `global`, which it inspects to figure out what to mock and what features to support. When invoking this function with a global, you will get back an object with `timers`, `createClock` and `install` - same as the regular Lolex exports only based on the passed in global instead of the global environment.

## Running tests

Lolex has a comprehensive test suite. If you're thinking of contributing bug
Expand Down
Loading

0 comments on commit 6b3b127

Please sign in to comment.