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

require-inject

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-inject - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

7

index.js
"use strict";
var path = require("path")
var caller = require('caller');

@@ -33,4 +34,5 @@ module.exports = function (toLoad, mocks) {

var callerFilename = caller() == module.filename ? caller(2) : caller();
if (/^[.][.]?\//.test(toLoad)) {
toLoad = path.resolve(path.dirname(module.parent.filename), toLoad)
toLoad = path.resolve(path.dirname(callerFilename), toLoad)
}

@@ -41,5 +43,4 @@ var toLoadPath = require.resolve(toLoad)

delete require.cache[toLoadPath]
// load our new version using our mocks
return module.parent.require(toLoadPath)
return require.cache[callerFilename].require(toLoadPath);
}
{
"name": "require-inject",
"version": "1.2.1",
"version": "1.3.0",
"description": "A simple mock injector compatible needing no instrumentation in the libraries being tested",

@@ -24,3 +24,6 @@ "main": "index.js",

"tap": "^0.4.13"
},
"dependencies": {
"caller": "^1.0.1"
}
}
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