@jest/fake-timers
Advanced tools
Sorry, the diff of this file is not supported yet
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"jestFakeTimers.d.ts","sourceRoot":"","sources":["../src/jestFakeTimers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAmB,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAErE,aAAK,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;AA2BlD,aAAK,WAAW,CAAC,GAAG,IAAI;IACtB,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,GAAG,CAAC;IAC7B,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,GAAG,IAAI,CAAC;CACtC,CAAC;AAcF,MAAM,CAAC,OAAO,OAAO,UAAU,CAAC,QAAQ;IACtC,OAAO,CAAC,oBAAoB,CAA4B;IACxD,OAAO,CAAC,eAAe,CAA4B;IACnD,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,SAAS,CAAC,CAAU;IAC5B,OAAO,CAAC,cAAc,CAAY;IAClC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,UAAU,CAAW;IAC7B,OAAO,CAAC,OAAO,CAA0B;IACzC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,YAAY,CAAwB;gBAEhC,EACV,MAAM,EACN,YAAY,EACZ,WAAW,EACX,MAAM,EACN,QAAQ,GACT,EAAE;QACD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;QACtB,YAAY,EAAE,YAAY,CAAC;QAC3B,WAAW,EAAE,WAA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ectSpread(target) { | ||
| for (var i = 1; i < arguments.length; i++) { | ||
| var source = arguments[i] != null ? arguments[i] : {}; | ||
| var ownKeys = Object.keys(source); | ||
| if (typeof Object.getOwnPropertySymbols === 'function') { | ||
| ownKeys = ownKeys.concat( | ||
| Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
| return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
| }) | ||
| ); | ||
| } | ||
| ownKeys.forEach(function(key) { | ||
| _defineProperty(target, key, source[key]); | ||
| }); | ||
| } | ||
| return target; | ||
| } | ||
| function _defineProperty(obj, key, value) { | ||
@@ -60,2 +42,32 @@ if (key in obj) { | ||
| constructor({global, moduleMocker, timerConfig, config, maxLoops}) { | ||
| _defineProperty(this, '_cancelledImmediates', void 0); | ||
| _defineProperty(this, '_cancelledTicks', void 0); | ||
| _defineProperty(this, '_config', void 0); | ||
| _defineProperty(this, '_disposed', void 0); | ||
| _defineProperty(this, '_fakeTimerAPIs', void 0); | ||
| _defineProperty(this, '_global', void 0); | ||
| _defineProperty(this, '_immediates', void 0); | ||
| _defineProperty(this, '_maxLoops', void 0); | ||
| _defineProperty(this, '_moduleMocker', void 0); | ||
| _defineProperty(this, '_now', void 0); | ||
| _defineProperty(this, '_ticks', void 0); | ||
| _defineProperty(this, '_timerAPIs', void 0); | ||
| _defineProperty(this, '_timers', void 0); | ||
| _defineProperty(this, '_uuidCounter', void 0); | ||
| _defineProperty(this, '_timerConfig', void 0); | ||
| this._global = global; | ||
@@ -87,5 +99,3 @@ this._timerConfig = timerConfig; | ||
| for (const uuid in this._timers) { | ||
| delete this._timers[uuid]; | ||
| } | ||
| this._timers.clear(); | ||
| } | ||
@@ -104,3 +114,3 @@ | ||
| this._immediates = []; | ||
| this._timers = {}; | ||
| this._timers = new Map(); | ||
| } | ||
@@ -211,3 +221,6 @@ | ||
| runOnlyPendingTimers() { | ||
| const timers = _objectSpread({}, this._timers); | ||
| // We need to hold the current shape of `this._timers` because existing | ||
| // timers can add new ones to the map and hence would run more than necessary. | ||
| // See https://github.com/facebook/jest/pull/4608 for details | ||
| const timerEntries = Array.from(this._timers.entries()); | ||
@@ -218,5 +231,5 @@ this._checkFakeTimers(); | ||
| Object.keys(timers) | ||
| .sort((left, right) => timers[left].expiry - timers[right].expiry) | ||
| .forEach(this._runTimerHandle, this); | ||
| timerEntries | ||
| .sort(([, left], [, right]) => left.expiry - right.expiry) | ||
| .forEach(([timerHandle]) => this._runTimerHandle(timerHandle)); | ||
| } | ||
@@ -237,4 +250,10 @@ | ||
| const nextTimerExpiry = this._timers[timerHandle].expiry; | ||
| const timerValue = this._timers.get(timerHandle); | ||
| if (timerValue === undefined) { | ||
| break; | ||
| } | ||
| const nextTimerExpiry = timerValue.expiry; | ||
| if (this._now + msToRun < nextTimerExpiry) { | ||
@@ -322,3 +341,3 @@ // There are no timers between now and the target we're running to, so | ||
| return Object.keys(this._timers).length; | ||
| return this._timers.size + this._immediates.length + this._ticks.length; | ||
| } | ||
@@ -367,4 +386,4 @@ | ||
| if (uuid && this._timers.hasOwnProperty(uuid)) { | ||
| delete this._timers[String(uuid)]; | ||
| if (uuid) { | ||
| this._timers.delete(String(uuid)); | ||
| } | ||
@@ -455,3 +474,4 @@ } | ||
| const uuid = this._uuidCounter++; | ||
| this._timers[String(uuid)] = { | ||
| this._timers.set(String(uuid), { | ||
| callback: (function(_callback3) { | ||
@@ -471,3 +491,4 @@ function callback() { | ||
| type: 'interval' | ||
| }; | ||
| }); | ||
| return this._timerConfig.idToRef(uuid); | ||
@@ -483,3 +504,4 @@ } | ||
| const uuid = this._uuidCounter++; | ||
| this._timers[String(uuid)] = { | ||
| this._timers.set(String(uuid), { | ||
| callback: (function(_callback4) { | ||
@@ -499,3 +521,4 @@ function callback() { | ||
| type: 'timeout' | ||
| }; | ||
| }); | ||
| return this._timerConfig.idToRef(uuid); | ||
@@ -506,9 +529,5 @@ } | ||
| let nextTimerHandle = null; | ||
| let uuid; | ||
| let soonestTime = MS_IN_A_YEAR; | ||
| let timer; | ||
| for (uuid in this._timers) { | ||
| timer = this._timers[uuid]; | ||
| this._timers.forEach((timer, uuid) => { | ||
| if (timer.expiry < soonestTime) { | ||
@@ -518,3 +537,3 @@ soonestTime = timer.expiry; | ||
| } | ||
| } | ||
| }); | ||
@@ -525,3 +544,3 @@ return nextTimerHandle; | ||
| _runTimerHandle(timerHandle) { | ||
| const timer = this._timers[timerHandle]; | ||
| const timer = this._timers.get(timerHandle); | ||
@@ -535,3 +554,5 @@ if (!timer) { | ||
| const callback = timer.callback; | ||
| delete this._timers[timerHandle]; | ||
| this._timers.delete(timerHandle); | ||
| callback(); | ||
@@ -538,0 +559,0 @@ break; |
+5
-6
| { | ||
| "name": "@jest/fake-timers", | ||
| "version": "24.5.0", | ||
| "version": "24.6.0", | ||
| "repository": { | ||
@@ -13,6 +13,5 @@ "type": "git", | ||
| "dependencies": { | ||
| "@jest/types": "^24.5.0", | ||
| "@types/node": "*", | ||
| "jest-message-util": "^24.5.0", | ||
| "jest-mock": "^24.5.0" | ||
| "@jest/types": "^24.6.0", | ||
| "jest-message-util": "^24.6.0", | ||
| "jest-mock": "^24.6.0" | ||
| }, | ||
@@ -25,3 +24,3 @@ "engines": { | ||
| }, | ||
| "gitHead": "800533020f5b2f153615c821ed7cb12fd868fa6f" | ||
| "gitHead": "04e6a66d2ba8b18bee080bb28547db74a255d2c7" | ||
| } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
203037
892.6%3
-25%10
11.11%4
33.33%- Removed
- Removed
- Removed
Updated
Updated
Updated