Comparing version 2.1.3 to 2.1.4
Changelog | ||
--------- | ||
### 2.1.3 | ||
- Fix shadowing of internal `module`, `exports` and `require` when a global counterpart exists [jhnns/rewire-webpack#6](https://github.com/jhnns/rewire-webpack/pull/6) | ||
### 2.1.2 | ||
- Fixed missing `var` statement which lead to pollution of global namespace [#33](https://github.com/jhnns/rewire/pull/33) | ||
@@ -7,0 +9,0 @@ |
@@ -29,3 +29,8 @@ /** | ||
value = globalObj[key]; | ||
src += "var " + key + " = global." + key + "; "; | ||
// key may be an invalid variable name (e.g. 'a-b') | ||
try { | ||
eval("var " + key + ";"); | ||
src += "var " + key + " = global." + key + "; "; | ||
} catch(e) {} | ||
} | ||
@@ -36,2 +41,2 @@ | ||
module.exports = getImportGlobalsSrc; | ||
module.exports = getImportGlobalsSrc; |
{ | ||
"name" : "rewire", | ||
"version" : "2.1.3", | ||
"description" : "Easy dependency injection for node.js unit testing", | ||
"keywords" : [ | ||
"dependency", | ||
"injection", | ||
"mock", | ||
"shim", | ||
"module", | ||
"unit", | ||
"test", | ||
"leak", | ||
"inspect" | ||
], | ||
"author" : { | ||
"name" : "Johannes Ewald", | ||
"email" : "mail@johannesewald.de" | ||
}, | ||
"main" : "lib/index.js", | ||
"homepage": "https://github.com/jhnns/rewire", | ||
"bugs" : { | ||
"url" : "https://github.com/jhnns/rewire/issues", | ||
"email" : "mail@johannesewald.de" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jhnns/rewire.git" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.x", | ||
"expect.js": "0.x", | ||
"coffee-script": "1.x" | ||
}, | ||
"scripts" : { | ||
"test" : "node node_modules/mocha/bin/mocha -R spec", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha" | ||
} | ||
} | ||
"name": "rewire", | ||
"version": "2.1.4", | ||
"description": "Easy dependency injection for node.js unit testing", | ||
"keywords": [ | ||
"dependency", | ||
"injection", | ||
"mock", | ||
"shim", | ||
"module", | ||
"unit", | ||
"test", | ||
"leak", | ||
"inspect" | ||
], | ||
"author": { | ||
"name": "Johannes Ewald", | ||
"email": "mail@johannesewald.de" | ||
}, | ||
"main": "lib/index.js", | ||
"homepage": "https://github.com/jhnns/rewire", | ||
"bugs": { | ||
"url": "https://github.com/jhnns/rewire/issues", | ||
"email": "mail@johannesewald.de" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jhnns/rewire.git" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "^1.8.0", | ||
"expect.js": "^0.3.1", | ||
"mocha": "^2.1.0" | ||
}, | ||
"scripts": { | ||
"test": "node node_modules/mocha/bin/mocha -R spec", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha" | ||
} | ||
} |
@@ -154,2 +154,11 @@ rewire | ||
**Globals with invalid variable names**<br> | ||
rewire imports global variables into the local scope by prepending a list of `var` declarations: | ||
```javascript | ||
var someGlobalVar = global.someGlobalVar; | ||
``` | ||
If `someGlobalVar` is not a valid variable name, rewire just ignores it. **In this case you're not able to override the global variable locally**. | ||
<br /> | ||
@@ -156,0 +165,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
203
4
22408
18
286
1