You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/release-source/release/fake-timers.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ test code using them.
11
11
Fake timers provide a `clock` object to pass time, which can also be used to control `Date` objects created through either `new Date();`
12
12
or `Date.now();` (if supported by the browser).
13
13
14
-
For standalone usage of fake timers it is recommended to use [lolex](https://github.com/sinonjs/lolex) package instead. It provides the same
14
+
For standalone usage of fake timers it is recommended to use [fake-timers](https://github.com/sinonjs/fake-timers) package instead. It provides the same
15
15
set of features (Sinon uses it under the hood) and was previously extracted from Sinon.JS.
16
16
17
17
```javascript
@@ -50,20 +50,19 @@ Starts the clock at the UNIX epoch (timestamp of `0`).
50
50
#### `var clock = sinon.useFakeTimers(now);`
51
51
52
52
As above, but rather than starting the clock with a timestamp of 0, start at the provided timestamp `now`.
53
-
54
-
*Since `sinon@2.0.0`*
55
-
56
53
You can also pass in a Date object, and its `getTime()` will be used for the starting timestamp.
57
54
58
55
#### `var clock = sinon.useFakeTimers(config);`
59
56
60
-
As above, but allows further configuration options, some of which are:
57
+
As above, but allows further configuration options.
61
58
62
59
-`config.now` - *Number/Date* - installs lolex with the specified unix epoch (default: 0)
63
60
-`config.toFake` - *String[]* - an array with explicit function names to fake. By default lolex will automatically fake all methods *except*`process.nextTick`. You could, however, still fake `nextTick` by providing it explicitly
64
61
-`config.shouldAdvanceTime` - *Boolean* - tells lolex to increment mocked time automatically based on the real system time shift (default: false). When used in conjunction with `config.toFake`, it will only work if `'setInterval'` is included in `config.toFake`.
62
+
-**`config.global`** - *Object* - use `global` instead of the usual global object. This is useful if you use JSDOM along with Node.
65
63
66
-
Please refer to the `lolex.install`[documentation](https://github.com/sinonjs/lolex#var-clock--lolexinstallconfig) for the full set of features available and more elaborate explanations.
64
+
The options are basically all of those supported by the `install()` method of our `fake-timers` library, with the sole exception of `global`.
65
+
Please refer to the `fakeTimers.install`[documentation](https://github.com/sinonjs/fake-timers/#var-clock--faketimersinstallconfig) for the full set of features available and more elaborate explanations.
0 commit comments