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

proxyquire

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proxyquire - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

12

lib/proxyquire.js

@@ -115,9 +115,15 @@ 'use strict';

for (var key in stubs) {
if (stubs[key] === null) continue;
var stub = stubs[key];
if (hasOwnProperty.call(stubs[key], '@global')) {
if (stub === null) continue;
if (typeof stub === 'undefined') {
throw new ProxyquireError('Invalid stub: "' + key + '" cannot be undefined');
}
if (hasOwnProperty.call(stub, '@global')) {
this._containsGlobal = true;
}
if (hasOwnProperty.call(stubs[key], '@runtimeGlobal')) {
if (hasOwnProperty.call(stub, '@runtimeGlobal')) {
this._containsGlobal = true;

@@ -124,0 +130,0 @@ this._containsRuntimeGlobal = true;

{
"name": "proxyquire",
"version": "1.6.0",
"version": "1.7.0",
"description": "Proxies nodejs require in order to allow overriding dependencies during testing.",

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

@@ -62,2 +62,14 @@ /*jshint asi:true*/

})
describe('when I pass an undefined stub', function () {
function act () {
proxyquire('./samples/foo', {
myStub: undefined
})
}
it('throws an exception with the stub key', function () {
throws(act, /Invalid stub: "myStub" cannot be undefined/)
})
})
})
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