@jest/fake-timers
Advanced tools
Comparing version 29.4.3 to 29.5.0
@@ -86,5 +86,9 @@ /** | ||
runAllTimers(): void; | ||
runAllTimersAsync(): Promise<void>; | ||
runOnlyPendingTimers(): void; | ||
runOnlyPendingTimersAsync(): Promise<void>; | ||
advanceTimersToNextTimer(steps?: number): void; | ||
advanceTimersToNextTimerAsync(steps?: number): Promise<void>; | ||
advanceTimersByTime(msToRun: number): void; | ||
advanceTimersByTimeAsync(msToRun: number): Promise<void>; | ||
runAllTicks(): void; | ||
@@ -91,0 +95,0 @@ useRealTimers(): void; |
@@ -53,2 +53,7 @@ 'use strict'; | ||
} | ||
async runAllTimersAsync() { | ||
if (this._checkFakeTimers()) { | ||
await this._clock.runAllAsync(); | ||
} | ||
} | ||
runOnlyPendingTimers() { | ||
@@ -59,2 +64,7 @@ if (this._checkFakeTimers()) { | ||
} | ||
async runOnlyPendingTimersAsync() { | ||
if (this._checkFakeTimers()) { | ||
await this._clock.runToLastAsync(); | ||
} | ||
} | ||
advanceTimersToNextTimer(steps = 1) { | ||
@@ -72,2 +82,14 @@ if (this._checkFakeTimers()) { | ||
} | ||
async advanceTimersToNextTimerAsync(steps = 1) { | ||
if (this._checkFakeTimers()) { | ||
for (let i = steps; i > 0; i--) { | ||
await this._clock.nextAsync(); | ||
// Fire all timers at this point: https://github.com/sinonjs/fake-timers/issues/250 | ||
await this._clock.tickAsync(0); | ||
if (this._clock.countTimers() === 0) { | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
advanceTimersByTime(msToRun) { | ||
@@ -78,2 +100,7 @@ if (this._checkFakeTimers()) { | ||
} | ||
async advanceTimersByTimeAsync(msToRun) { | ||
if (this._checkFakeTimers()) { | ||
await this._clock.tickAsync(msToRun); | ||
} | ||
} | ||
runAllTicks() { | ||
@@ -80,0 +107,0 @@ if (this._checkFakeTimers()) { |
{ | ||
"name": "@jest/fake-timers", | ||
"version": "29.4.3", | ||
"version": "29.5.0", | ||
"repository": { | ||
@@ -20,11 +20,11 @@ "type": "git", | ||
"dependencies": { | ||
"@jest/types": "^29.4.3", | ||
"@jest/types": "^29.5.0", | ||
"@sinonjs/fake-timers": "^10.0.2", | ||
"@types/node": "*", | ||
"jest-message-util": "^29.4.3", | ||
"jest-mock": "^29.4.3", | ||
"jest-util": "^29.4.3" | ||
"jest-message-util": "^29.5.0", | ||
"jest-mock": "^29.5.0", | ||
"jest-util": "^29.5.0" | ||
}, | ||
"devDependencies": { | ||
"@jest/test-utils": "^29.4.3", | ||
"@jest/test-utils": "^29.5.0", | ||
"@types/sinonjs__fake-timers": "^8.1.2" | ||
@@ -38,3 +38,3 @@ }, | ||
}, | ||
"gitHead": "a49c88610e49a3242576160740a32a2fe11161e1" | ||
"gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26302
850
Updated@jest/types@^29.5.0
Updatedjest-message-util@^29.5.0
Updatedjest-mock@^29.5.0
Updatedjest-util@^29.5.0