Skip to content

Commit 80bc1d9

Browse files
authoredOct 31, 2024··
Fix out-of-date fake-timers docs (#2628)
* Fix documentation issue for fake-timers mentioned in #2625 The docs were out of sync with the fake-timers docs. * Update dependencies before new patch version
1 parent 527568c commit 80bc1d9

File tree

3 files changed

+350
-884
lines changed

3 files changed

+350
-884
lines changed
 

‎docs/release-source/release/fake-timers.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ You can also pass in a Date object, and its `getTime()` will be used for the sta
5858

5959
As above, but allows further configuration options.
6060

61-
- `config.now` - _Number/Date_ - installs lolex with the specified unix epoch (default: 0)
62-
- `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
63-
- `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`.
61+
- `config.now` - _Number/Date_ - installs `fake-timers` with the specified unix epoch (default: 0)
62+
- `config.toFake` - _String[ ]_ - an array with explicit function names to fake. By default `fake-timers` will automatically fake _all_ methods (changed in v19).
63+
- `config.shouldAdvanceTime` - _Boolean_ - tells `fake-timers` 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`.
6464
- **`config.global`** - _Object_ - use `global` instead of the usual global object. This is useful if you use JSDOM along with Node.
6565

6666
The options are basically all of those supported by the `install()` method of our `fake-timers` library, with the sole exception of `global`.
@@ -70,7 +70,7 @@ _Since `sinon@3.0.0`_
7070

7171
`var clock = sinon.useFakeTimers([now, ]prop1, prop2, ...)` is no longer supported. To define which methods to fake, please use `config.toFake`.
7272

73-
**Important note:** when faking `nextTick`, normal calls to `process.nextTick()` would not execute automatically as they would during normal event-loop phases. You would have to call either `clock.next()`, `clock.tick()`, `clock.runAll()` or `clock.runToLast()` (see example below). Please refer to the [lolex](https://github.com/sinonjs/lolex) documentation for more information.
73+
**Important note:** when faking `nextTick`, normal calls to `process.nextTick()` will not execute automatically as they would during normal event-loop phases. You would have to call either `clock.next()`, `clock.tick()`, `clock.runAll()` or `clock.runToLast()` manually (see example below). You can easily work around this using the `config.toFake` option. Please refer to the [`fake-timers`](https://github.com/sinonjs/fake-timers) documentation for more information.
7474

7575
#### Examples
7676

‎package-lock.json

+345-879
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
},
8282
"dependencies": {
8383
"@sinonjs/commons": "^3.0.1",
84-
"@sinonjs/fake-timers": "^13.0.2",
84+
"@sinonjs/fake-timers": "^13.0.5",
8585
"@sinonjs/samsam": "^8.0.1",
8686
"diff": "^7.0.0",
8787
"nise": "^6.1.1",

0 commit comments

Comments
 (0)
Please sign in to comment.