proxyquire
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -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/) | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58711
1238
1