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

jest-mock

Package Overview
Dependencies
Maintainers
6
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 28.1.0 to 28.1.1

2

build/index.d.ts

@@ -73,3 +73,3 @@ /**

export declare const mocked: {
<T>(item: T, deep?: false | undefined): MaybeMocked<T>;
<T>(item: T, deep?: false): MaybeMocked<T>;
<T_1>(item: T_1, deep: true): MaybeMockedDeep<T_1>;

@@ -76,0 +76,0 @@ };

@@ -27,4 +27,5 @@ 'use strict';

*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
const MOCK_CONSTRUCTOR_NAME = 'mockConstructor';
const FUNCTION_NAME_RESERVED_PATTERN = /[\s!-\/:-@\[-`{-~]/;
const FUNCTION_NAME_RESERVED_PATTERN = /[\s!-/:-@[-`{-~]/;
const FUNCTION_NAME_RESERVED_REPLACE = new RegExp(

@@ -367,3 +368,3 @@ FUNCTION_NAME_RESERVED_PATTERN.source,

const prototypeSlots = this._getSlots(prototype);
const prototypeSlots = this._getSlots(prototype); // eslint-disable-next-line @typescript-eslint/no-this-alias

@@ -621,3 +622,3 @@ const mocker = this;

// overloading of _makeComponent and not _generateMock?
// @ts-expect-error
// @ts-expect-error - unsure why TSC complains here?
const mock = this._makeComponent(metadata);

@@ -786,3 +787,5 @@

throw new Error(
`Cannot spy the ${methodName} property because it is not a function; ${this._typeOf(
`Cannot spy the ${String(
methodName
)} property because it is not a function; ${this._typeOf(
original

@@ -856,3 +859,3 @@ )} given instead`

throw new Error(
`spyOn could not find an object to spy upon for ${propertyName}`
`spyOn could not find an object to spy upon for ${String(propertyName)}`
);

@@ -874,7 +877,7 @@ }

if (!descriptor) {
throw new Error(`${propertyName} property does not exist`);
throw new Error(`${String(propertyName)} property does not exist`);
}
if (!descriptor.configurable) {
throw new Error(`${propertyName} is not declared configurable`);
throw new Error(`${String(propertyName)} is not declared configurable`);
}

@@ -884,3 +887,5 @@

throw new Error(
`Property ${propertyName} does not have access type ${accessType}`
`Property ${String(
propertyName
)} does not have access type ${accessType}`
);

@@ -894,3 +899,5 @@ }

throw new Error(
`Cannot spy the ${propertyName} property because it is not a function; ${this._typeOf(
`Cannot spy the ${String(
propertyName
)} property because it is not a function; ${this._typeOf(
original

@@ -912,3 +919,3 @@ )} given instead`

descriptor[accessType].mockImplementation(function () {
// @ts-expect-error
// @ts-expect-error - wrong context
return original.apply(this, arguments);

@@ -915,0 +922,0 @@ });

{
"name": "jest-mock",
"version": "28.1.0",
"version": "28.1.1",
"repository": {

@@ -20,7 +20,7 @@ "type": "git",

"dependencies": {
"@jest/types": "^28.1.0",
"@jest/types": "^28.1.1",
"@types/node": "*"
},
"devDependencies": {
"@tsd/typescript": "~4.6.2",
"@tsd/typescript": "~4.7.3",
"tsd-lite": "^0.5.1"

@@ -34,3 +34,3 @@ },

},
"gitHead": "f5db241312f46528389e55c38221e6b6968622cf"
"gitHead": "eb954f8874960920ac50a8f976bb333fbb06ada9"
}
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