Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jest/fake-timers

Package Overview
Dependencies
Maintainers
6
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jest/fake-timers - npm Package Compare versions

Comparing version 24.9.0 to 25.0.0

2

build/index.js

@@ -8,3 +8,3 @@ 'use strict';

enumerable: true,
get: function get() {
get: function() {
return _jestFakeTimers.default;

@@ -11,0 +11,0 @@ }

@@ -16,3 +16,2 @@ /**

export default class FakeTimers<TimerRef> {
private _cancelledImmediates;
private _cancelledTicks;

@@ -19,0 +18,0 @@ private _config;

@@ -11,3 +11,3 @@ 'use strict';

_jestMessageUtil = function _jestMessageUtil() {
_jestMessageUtil = function() {
return data;

@@ -42,4 +42,2 @@ };

constructor({global, moduleMocker, timerConfig, config, maxLoops}) {
_defineProperty(this, '_cancelledImmediates', void 0);
_defineProperty(this, '_cancelledTicks', void 0);

@@ -95,5 +93,3 @@

clearAllTimers() {
this._immediates.forEach(immediate =>
this._fakeClearImmediate(immediate.uuid)
);
this._immediates = [];

@@ -110,3 +106,2 @@ this._timers.clear();

this._cancelledTicks = {};
this._cancelledImmediates = {};
this._now = 0;

@@ -174,6 +169,6 @@ this._ticks = [];

_runImmediate(immediate) {
if (!this._cancelledImmediates.hasOwnProperty(immediate.uuid)) {
// Callback may throw, so update the map prior calling.
this._cancelledImmediates[immediate.uuid] = true;
try {
immediate.callback();
} finally {
this._fakeClearImmediate(immediate.uuid);
}

@@ -408,3 +403,5 @@ }

_fakeClearImmediate(uuid) {
this._cancelledImmediates[uuid] = true;
this._immediates = this._immediates.filter(
immediate => immediate.uuid !== uuid
);
}

@@ -420,13 +417,3 @@

this._ticks.push({
callback: (function(_callback) {
function callback() {
return _callback.apply(this, arguments);
}
callback.toString = function() {
return _callback.toString();
};
return callback;
})(() => callback.apply(null, args)),
callback: () => callback.apply(null, args),
uuid

@@ -451,26 +438,16 @@ });

const uuid = this._uuidCounter++;
const uuid = String(this._uuidCounter++);
this._immediates.push({
callback: (function(_callback2) {
function callback() {
return _callback2.apply(this, arguments);
}
callback.toString = function() {
return _callback2.toString();
};
return callback;
})(() => callback.apply(null, args)),
uuid: String(uuid)
callback: () => callback.apply(null, args),
uuid
});
const cancelledImmediates = this._cancelledImmediates;
this._timerAPIs.setImmediate(() => {
if (!cancelledImmediates.hasOwnProperty(uuid)) {
// Callback may throw, so update the map prior calling.
cancelledImmediates[String(uuid)] = true;
callback.apply(null, args);
if (this._immediates.find(x => x.uuid === uuid)) {
try {
callback.apply(null, args);
} finally {
this._fakeClearImmediate(uuid);
}
}

@@ -494,13 +471,3 @@ });

this._timers.set(String(uuid), {
callback: (function(_callback3) {
function callback() {
return _callback3.apply(this, arguments);
}
callback.toString = function() {
return _callback3.toString();
};
return callback;
})(() => callback.apply(null, args)),
callback: () => callback.apply(null, args),
expiry: this._now + intervalDelay,

@@ -523,13 +490,3 @@ interval: intervalDelay,

this._timers.set(String(uuid), {
callback: (function(_callback4) {
function callback() {
return _callback4.apply(this, arguments);
}
callback.toString = function() {
return _callback4.toString();
};
return callback;
})(() => callback.apply(null, args)),
callback: () => callback.apply(null, args),
expiry: this._now + delay,

@@ -536,0 +493,0 @@ interval: undefined,

{
"name": "@jest/fake-timers",
"version": "24.9.0",
"version": "25.0.0",
"repository": {

@@ -13,8 +13,8 @@ "type": "git",

"dependencies": {
"@jest/types": "^24.9.0",
"jest-message-util": "^24.9.0",
"jest-mock": "^24.9.0"
"@jest/types": "^25.0.0",
"jest-message-util": "^25.0.0",
"jest-mock": "^25.0.0"
},
"engines": {
"node": ">= 6"
"node": ">= 8"
},

@@ -24,3 +24,3 @@ "publishConfig": {

},
"gitHead": "9ad0f4bc6b8bdd94989804226c28c9960d9da7d1"
"gitHead": "ff9269be05fd8316e95232198fce3463bf2f270e"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc