diff options
Diffstat (limited to 'lib/rewire.js')
-rw-r--r-- | lib/rewire.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rewire.js b/lib/rewire.js index bb7c176..3daacef 100644 --- a/lib/rewire.js +++ b/lib/rewire.js @@ -6,6 +6,9 @@ var Module = require("module"), detectStrictMode = require("./detectStrictMode.js"), moduleEnv = require("./moduleEnv.js"); +var __get__Src = __get__.toString(), + __set__Src = __set__.toString(); + /** * Does actual rewiring the module. For further documentation @see index.js */ @@ -26,6 +29,7 @@ function internalRewire(parentModulePath, targetPath) { // Special support for older node versions that returned an array on Module._resolveFilename // @see https://github.com/joyent/node/blob/865b077819a9271a29f982faaef99dc635b57fbc/lib/module.js#L319 // TODO Remove this switch on the next major release + /* istanbul ignore next because it will be removed soon */ if (Array.isArray(targetPath)) { targetPath = targetPath[1]; } @@ -38,8 +42,8 @@ function internalRewire(parentModulePath, targetPath) { // We append our special setter and getter. appendix = "\n"; - appendix += "module.exports.__set__ = " + __set__.toString() + "; "; - appendix += "module.exports.__get__ = " + __get__.toString() + "; "; + appendix += "module.exports.__set__ = " + __set__Src + "; "; + appendix += "module.exports.__get__ = " + __get__Src + "; "; // Check if the module uses the strict mode. // If so we must ensure that "use strict"; stays at the beginning of the module. |