@exodus/test 1.0.0-rc.76 → 1.0.0-rc.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/jest.timers.js +7 -1
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ It can run your existing tests on [all runtimes and also browsers](#engines), wi
|
|
|
18
18
|
- Actual `expect` module, also `jest-extended` and `jest-when` just work on top
|
|
19
19
|
- Snapshots, including snapshot matchers
|
|
20
20
|
- Function and timer mocks
|
|
21
|
-
- [test.concurrent]()
|
|
22
|
-
- Module mocks (
|
|
21
|
+
- [test.concurrent](https://jestjs.io/docs/api#testconcurrentname-fn-timeout)
|
|
22
|
+
- Module mocks, including for ESM modules (already loaded ESM modules can be mocked only on `node:test`)
|
|
23
23
|
- Loads Jest configuration
|
|
24
24
|
- It works on Hermes too!
|
|
25
25
|
- Built-in network record/replay for offline tests, mocking `fetch` and `WebSocket` sessions
|
package/package.json
CHANGED
package/src/jest.timers.js
CHANGED
|
@@ -66,8 +66,14 @@ export function runOnlyPendingTimers() {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export function advanceTimersByTime(time) {
|
|
69
|
-
assert(Number.isSafeInteger(time) && time
|
|
69
|
+
assert(Number.isSafeInteger(time) && time >= 0)
|
|
70
70
|
assertEnabledTimers()
|
|
71
|
+
|
|
72
|
+
if (time === 0) {
|
|
73
|
+
mock.timers.tick(0)
|
|
74
|
+
return this
|
|
75
|
+
}
|
|
76
|
+
|
|
71
77
|
// We split this into multiple steps to run timers scheduled during the time we are running
|
|
72
78
|
const minSteps = Math.min(1000, time) // usually just split e.g. 5 seconds into 1000 * 5ms
|
|
73
79
|
const step = Number(Math.floor(time / minSteps).toPrecision(1))
|