proxyquire
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -174,2 +174,4 @@ 'use strict'; | ||
restoreCache(); | ||
} else { | ||
delete require.cache[Module._resolveFilename(path, module)]; | ||
} | ||
@@ -176,0 +178,0 @@ |
{ | ||
"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')]); | ||
}); | ||
}); | ||
}); |
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
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
53443
1130