-
-
Save adrianlee/2963880 to your computer and use it in GitHub Desktop.
testing an object which is shared between all instances of the current module and made accessible through require()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b = require('./b'); | |
var b2 = require('./b'); | |
console.log(b.test()); | |
console.log(b2.test()); | |
console.log("-----"); | |
b.omg(); | |
console.log(b.test()); | |
console.log(b2.test()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hello = "hello"; | |
module.exports = { | |
test: function () { | |
return hello; | |
}, | |
omg: function () { | |
hello = "hello_modified"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment