New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@drakensoftware/magicmock

Package Overview
Dependencies
Maintainers
1
Versions
13
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.0.1 to 1.1.0

11

dist/MagicMock.js

@@ -32,3 +32,6 @@ "use strict";

const path = __importStar(require("path"));
const serialize_anything_1 = __importDefault(require("serialize-anything"));
const serialize_javascript_1 = __importDefault(require("serialize-javascript"));
function deserialize(serializedJavascript) {
return eval('(' + serializedJavascript + ')');
}
let invocationCountMap = new Map();

@@ -49,3 +52,3 @@ function resetInvocations() {

const mock = async (...args) => {
const serializedArgs = serialize_anything_1.default.serialize(args);
const serializedArgs = (0, serialize_javascript_1.default)(args);
//Create magic mock directory if it does not exist

@@ -75,3 +78,3 @@ if (!fs.existsSync('__magicMock__'))

payloads[invocationIndex.toString()] =
JSON.parse(serialize_anything_1.default.serialize(result)); //As it is async, it is important to use the previously defined invocationIndex
JSON.parse((0, serialize_javascript_1.default)(result)); //As it is async, it is important to use the previously defined invocationIndex
fs.writeFileSync(mockPath, JSON.stringify(allPayloads, null, 2));

@@ -89,3 +92,3 @@ resolve(result);

console.log(`✨ MagicMock is using an snapshot for '${identifier}'`);
return new Promise((resolve) => resolve(serialize_anything_1.default.deserialize(JSON.stringify(payloads[invocationIndex.toString()]))));
return new Promise((resolve) => resolve(deserialize(JSON.stringify(payloads[invocationIndex.toString()]))));
} //Payload does exist

@@ -92,0 +95,0 @@ };

{
"name": "@drakensoftware/magicmock",
"version": "1.0.1",
"version": "1.1.0",
"description": "Create your mocks automagically",

@@ -21,2 +21,3 @@ "main": "dist/index.js",

"@types/jest": "^29.5.12",
"@types/serialize-javascript": "^5.0.4",
"@typescript-eslint/eslint-plugin": "^7.3.1",

@@ -30,4 +31,4 @@ "@typescript-eslint/parser": "^7.3.1",

"dependencies": {
"serialize-anything": "^1.2.3"
"serialize-javascript": "^6.0.2"
}
}

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