Socket
Socket
Sign inDemoInstall

rewire

Package Overview
Dependencies
0
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.1.1

3

CHANGELOG.md
##Changelog
###v1.1.1
- Fixed bug with modules that had a comment on the last line
###v1.1.0

@@ -4,0 +7,0 @@ - Added Coffee-Script support

3

lib/rewire.js

@@ -40,3 +40,4 @@ var Module = require("module"),

// We append our special setter and getter.
appendix = "module.exports.__set__ = " + __set__.toString() + "; ";
appendix = "\n";
appendix += "module.exports.__set__ = " + __set__.toString() + "; ";
appendix += "module.exports.__get__ = " + __get__.toString() + "; ";

@@ -43,0 +44,0 @@

{
"name" : "rewire",
"version" : "1.1.0",
"version" : "1.1.1",
"description" : "Dependency injection for node.js applications",

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

"use strict"; // run code in ES5 strict mode
var someVar;
// Comment on file end. Hope this won't break anything

@@ -148,2 +148,8 @@ // Don't run code in ES5 strict mode.

});
it("should not be a problem to have a comment on file end", function () {
var rewired = rewire("./emptyModule.js");
rewired.__set__("someVar", "hello");
expect(rewired.__get__("someVar")).to.be("hello");
});
it("should not influence the original require if nothing has been required within the rewired module", function () {

@@ -150,0 +156,0 @@ rewire("./emptyModule.js"); // nothing happens here because emptyModule doesn't require anything

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc