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

rewire

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rewire - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

.editorconfig

8

CHANGELOG.md
Changelog
---------
### 2.1.5
- Fix issues with reverting nested properties
### 2.1.4
- Fix problems when an illegal variable name is used for a global
### 2.1.3

@@ -55,2 +61,2 @@ - 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)

- Moved browserify-middleware from `rewire.browserify` to `rewire.bundlers.browserify`
- Reached stable state :)
- Reached stable state :)

13

lib/__set__.js

@@ -16,3 +16,3 @@ /**

arguments.src = "";
arguments.snapshot = {};
arguments.revertArgs = [];

@@ -24,2 +24,3 @@ if (typeof arguments[0] === "object" && arguments.length === 1) {

}
arguments.revertArgs[0] = {};
for (arguments.varName in arguments.env) {

@@ -29,3 +30,3 @@ if (arguments.env.hasOwnProperty(arguments.varName)) {

arguments.src += arguments.varName + " = arguments.env." + arguments.varName + "; ";
arguments.snapshot[arguments.varName] = eval(arguments.varName);
arguments.revertArgs[0][arguments.varName] = eval(arguments.varName);
}

@@ -38,3 +39,3 @@ }

arguments.src = arguments.varName + " = arguments.varValue;";
arguments.snapshot[arguments.varName] = eval(arguments.varName);
arguments.revertArgs = [arguments.varName, eval(arguments.varName)];
} else {

@@ -46,7 +47,7 @@ throw new TypeError("__set__ expects an environment object or a non-empty string as a variable name");

return function (snapshot) {
module.exports.__set__(snapshot);
}.bind(null, arguments.snapshot);
return function (revertArgs) {
__set__.apply(null, revertArgs);
}.bind(null, arguments.revertArgs);
}
module.exports = __set__;
{
"name": "rewire",
"version": "2.1.4",
"version": "2.1.5",
"description": "Easy dependency injection for node.js unit testing",

@@ -36,5 +36,5 @@ "keywords": [

"scripts": {
"test": "node node_modules/mocha/bin/mocha -R spec",
"test": "mocha -R spec --check-leaks",
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha"
}
}

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