Socket
Socket
Sign inDemoInstall

jest-mock

Package Overview
Dependencies
Maintainers
5
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-mock - npm Package Compare versions

Comparing version 20.1.0-delta.5 to 20.1.0-echo.1

67

build-es5/index.js

@@ -1472,2 +1472,61 @@ (function (global, factory) {

function matchArity(fn, length) {
var mockConstructor = void 0;
switch (length) {
case 1:
mockConstructor = function mockConstructor(a) {
return fn.apply(this, arguments);
};
break;
case 2:
mockConstructor = function mockConstructor(a, b) {
return fn.apply(this, arguments);
};
break;
case 3:
mockConstructor = function mockConstructor(a, b, c) {
return fn.apply(this, arguments);
};
break;
case 4:
mockConstructor = function mockConstructor(a, b, c, d) {
return fn.apply(this, arguments);
};
break;
case 5:
mockConstructor = function mockConstructor(a, b, c, d, e) {
return fn.apply(this, arguments);
};
break;
case 6:
mockConstructor = function mockConstructor(a, b, c, d, e, f) {
return fn.apply(this, arguments);
};
break;
case 7:
mockConstructor = function mockConstructor(a, b, c, d, e, f, g) {
return fn.apply(this, arguments);
};
break;
case 8:
mockConstructor = function mockConstructor(a, b, c, d, e, f, g, h) {
return fn.apply(this, arguments);
};
break;
case 9:
mockConstructor = function mockConstructor(a, b, c, d, e, f, g, h, i) {
return fn.apply(this, arguments);
};
break;
default:
mockConstructor = function mockConstructor() {
return fn.apply(this, arguments);
};
break;
}
return mockConstructor;
}
function isA(typeName, value) {

@@ -1606,3 +1665,3 @@ return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';

var mocker = this;
var mockConstructor = function mockConstructor() {
var mockConstructor = matchArity(function () {
var _this = this;

@@ -1663,3 +1722,3 @@

return returnValue;
};
}, metadata.length || 0);

@@ -1791,2 +1850,3 @@ f = this._createMockFunction(metadata, mockConstructor);

var createConstructor = new this._environmentGlobal.Function(MOCK_CONSTRUCTOR_NAME, body);
return createConstructor(mockConstructor);

@@ -1922,3 +1982,4 @@ }

value: function fn(implementation) {
var fn = this._makeComponent({ type: 'function' });
var length = implementation ? implementation.length : 0;
var fn = this._makeComponent({ length: length, type: 'function' });
if (implementation) {

@@ -1925,0 +1986,0 @@ fn.mockImplementation(implementation);

@@ -37,2 +37,3 @@ 'use strict';

const MOCK_CONSTRUCTOR_NAME = 'mockConstructor';

@@ -92,2 +93,61 @@

function matchArity(fn, length) {
let mockConstructor;
switch (length) {
case 1:
mockConstructor = function (a) {
return fn.apply(this, arguments);
};
break;
case 2:
mockConstructor = function (a, b) {
return fn.apply(this, arguments);
};
break;
case 3:
mockConstructor = function (a, b, c) {
return fn.apply(this, arguments);
};
break;
case 4:
mockConstructor = function (a, b, c, d) {
return fn.apply(this, arguments);
};
break;
case 5:
mockConstructor = function (a, b, c, d, e) {
return fn.apply(this, arguments);
};
break;
case 6:
mockConstructor = function (a, b, c, d, e, f) {
return fn.apply(this, arguments);
};
break;
case 7:
mockConstructor = function (a, b, c, d, e, f, g) {
return fn.apply(this, arguments);
};
break;
case 8:
mockConstructor = function (a, b, c, d, e, f, g, h) {
return fn.apply(this, arguments);
};
break;
case 9:
mockConstructor = function (a, b, c, d, e, f, g, h, i) {
return fn.apply(this, arguments);
};
break;
default:
mockConstructor = function () {
return fn.apply(this, arguments);
};
break;}
return mockConstructor;
}
function isA(typeName, value) {

@@ -247,3 +307,3 @@ return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';

const mocker = this;
const mockConstructor = function () {
const mockConstructor = matchArity(function () {
const mockState = mocker._ensureMockState(f);

@@ -304,3 +364,3 @@ const mockConfig = mocker._ensureMockConfig(f);

return returnValue;
};
}, metadata.length || 0);

@@ -438,2 +498,3 @@ f = this._createMockFunction(metadata, mockConstructor);

return createConstructor(mockConstructor);

@@ -573,3 +634,4 @@ }

fn(implementation) {
const fn = this._makeComponent({ type: 'function' });
const length = implementation ? implementation.length : 0;
const fn = this._makeComponent({ length, type: 'function' });
if (implementation) {

@@ -576,0 +638,0 @@ fn.mockImplementation(implementation);

2

package.json
{
"name": "jest-mock",
"version": "20.1.0-delta.5",
"version": "20.1.0-echo.1",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

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