Comparing version 0.4.0 to 0.4.1
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.11.1 | ||
// Generated by CoffeeScript 1.12.4 | ||
(function() { | ||
var Module, _, config, doWithoutCache, fakeLoad, hackErrorStackToGetCallerFile, ignoredCallerFiles, originalLoad, path, quibble, quibbles, requireWasCalledFromAFileThatHasQuibbledStuff; | ||
var Module, _, config, doAndDeleteCache, doAndRestoreCache, doWithoutCache, fakeLoad, hackErrorStackToGetCallerFile, ignoredCallerFiles, originalLoad, path, quibble, quibbles, requireWasCalledFromAFileThatHasQuibbledStuff; | ||
@@ -16,2 +16,3 @@ _ = { | ||
uniq: require('lodash/uniq'), | ||
tap: require('lodash/tap'), | ||
values: require('lodash/values') | ||
@@ -106,14 +107,26 @@ }; | ||
doWithoutCache = function(request, parent, thingToDo) { | ||
var cachedThing, filename, result; | ||
var filename; | ||
filename = Module._resolveFilename(request, parent); | ||
if (!Module._cache.hasOwnProperty(filename)) { | ||
return thingToDo(); | ||
if (Module._cache.hasOwnProperty(filename)) { | ||
return doAndRestoreCache(filename, thingToDo); | ||
} else { | ||
return doAndDeleteCache(filename, thingToDo); | ||
} | ||
}; | ||
doAndRestoreCache = function(filename, thingToDo) { | ||
var cachedThing; | ||
cachedThing = Module._cache[filename]; | ||
delete Module._cache[filename]; | ||
result = thingToDo(); | ||
Module._cache[filename] = cachedThing; | ||
return result; | ||
return _.tap(thingToDo(), function() { | ||
return Module._cache[filename] = cachedThing; | ||
}); | ||
}; | ||
doAndDeleteCache = function(filename, thingToDo) { | ||
return _.tap(thingToDo(), function() { | ||
return delete Module._cache[filename]; | ||
}); | ||
}; | ||
hackErrorStackToGetCallerFile = function(includeGlobalIgnores) { | ||
@@ -120,0 +133,0 @@ var currentFile, e, originalFunc; |
{ | ||
"name": "quibble", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Makes it easy to replace require'd dependencies.", | ||
@@ -17,3 +17,3 @@ "homepage": "https://github.com/testdouble/quibble", | ||
"test:example": "cd example && npm test", | ||
"test:dependents": "npm run compile && dont-break --timeout 90", | ||
"test:dependents": "npm run compile && dont-break --timeout 400", | ||
"test:ci": "npm test && npm run test:example && npm run test:dependents", | ||
@@ -38,2 +38,3 @@ "preversion": "git pull --rebase && npm run test:ci", | ||
"mocha-given": "^0.1.3", | ||
"pryjs": "^1.0.3", | ||
"testem": "^0.9.7" | ||
@@ -40,0 +41,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
93571
27
230
7