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

@drakensoftware/magicmock

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@drakensoftware/magicmock - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

29

dist/Loader.js
"use strict";
//This file loads dynamically MagicMock only if it is needed
Object.defineProperty(exports, "__esModule", { value: true });
exports.callMocked = exports.mockClass = exports.mockFunction = void 0;
function iAmInNode() {
return typeof window === 'undefined';
}
function iAmTesting() {
return process?.env?.NODE_ENV === 'test';
}
function iAmDisabled() {
return process?.env?.DISABLE_MM;
}
function shouldIRun() {
return iAmInNode() && iAmTesting() && !iAmDisabled();
}
function mockFunction(thisArg, identifier, fn) {
if (!process.env.NODE_ENV || process.env.NODE_ENV !== 'test')
if (!shouldIRun())
return fn;

@@ -15,3 +28,3 @@ else {

function mockClass(thisArg, identifier, obj) {
if (!process.env.NODE_ENV || process.env.NODE_ENV !== 'test')
if (!shouldIRun())
return obj;

@@ -25,8 +38,12 @@ else {

exports.mockClass = mockClass;
function callMocked(func, identifier) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const module = require('./MagicMock');
return module.callMocked(func, identifier);
async function callMocked(func, identifier) {
if (!shouldIRun())
return await func();
else {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const module = require('./MagicMock');
return module.callMocked(func, identifier);
}
}
exports.callMocked = callMocked;
//# sourceMappingURL=Loader.js.map
{
"name": "@drakensoftware/magicmock",
"version": "1.3.1",
"version": "1.3.2",
"description": "Create your mocks automagically",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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