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

proxyquire

Package Overview
Dependencies
Maintainers
1
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.0.0 to 1.0.1

2

lib/proxyquire.js

@@ -174,2 +174,4 @@ 'use strict';

restoreCache();
} else {
delete require.cache[Module._resolveFilename(path, module)];
}

@@ -176,0 +178,0 @@

2

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

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

@@ -222,3 +222,3 @@ # proxyquire [![Build Status](https://secure.travis-ci.org/thlorenz/proxyquire.png)](http://travis-ci.org/thlorenz/proxyquire)

- make sure your modules are small enough and do only one thing
- stub out dependencies direclty instead of stubbing something inside your dependencies
- stub out dependencies directly instead of stubbing something inside your dependencies
- if you are testing `bar` and `bar` calls `foo.read` and `foo.read` calls `fs.readFile` proceed as follows

@@ -225,0 +225,0 @@ - **do not** stub out `fs.readFile` globally

@@ -77,3 +77,10 @@ /*jshint asi:true*/

});
it('deletes the require.cache for the module being stubbed', function() {
var proxyquire = require('..').noPreserveCache();
var foo = proxyquire.load('./samples/foo', { 'path': { } });
assert.equal(undefined, require.cache[require.resolve('./samples/foo')]);
});
});
});
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