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.7.10 to 1.7.11

17

lib/proxyquire.js

@@ -223,4 +223,21 @@ 'use strict';

for (var id in cache) {
// Keep native modules (i.e. `.node` files).
// Otherwise, Node.js would throw a “Module did not self-register”
// error upon requiring it a second time.
// See https://github.com/nodejs/node/issues/5016.
if (/\.node$/.test(id)) {
require.cache[id] = cache[id];
}
}
// Return a function that will undo what we just did
return function() {
// Keep native modules which were added to the cache in the meantime.
for (var id in require.cache) {
if (/\.node$/.test(id)) {
cache[id] = require.cache[id]
}
}
require.cache = Module._cache = cache;

@@ -227,0 +244,0 @@ };

5

package.json
{
"name": "proxyquire",
"version": "1.7.10",
"version": "1.7.11",
"description": "Proxies nodejs require in order to allow overriding dependencies during testing.",

@@ -27,3 +27,4 @@ "main": "index.js",

"devDependencies": {
"mocha": "~1.18",
"mocha": "~3.1",
"native-hello-world": "^1.0.0",
"should": "~3.3",

@@ -30,0 +31,0 @@ "sinon": "~1.9"

@@ -42,2 +42,13 @@ /*jshint asi:true*/

});
it('should not throw when a native module is required a second time', function () {
var stubs = {
'foo': {
'@global': true
}
};
proxyquire('native-hello-world', stubs)
proxyquire('native-hello-world', stubs)
})
});

@@ -44,0 +55,0 @@

.travis.yml

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