Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ewald <johannes.ewald@peerigon.com>2017-11-11 05:24:37 +0300
committerJohannes Ewald <johannes.ewald@peerigon.com>2017-11-11 05:24:37 +0300
commit9cd5ea14063d56e883ca8ba34a9b498ff480d66a (patch)
treec5ab1ddf226f92bbe27c044942dfd5f78e89277c
parent457955afab6e3f9baf649b6d9275d08f27b671ac (diff)
Remove legacy code for node < 4
-rw-r--r--lib/rewire.js8
-rw-r--r--test/getImportGlobalsSrc.test.js14
2 files changed, 2 insertions, 20 deletions
diff --git a/lib/rewire.js b/lib/rewire.js
index cbd24c2..e678f37 100644
--- a/lib/rewire.js
+++ b/lib/rewire.js
@@ -23,14 +23,6 @@ function internalRewire(parentModulePath, targetPath) {
// Resolve full filename relative to the parent module
targetPath = Module._resolveFilename(targetPath, parentModulePath);
- // 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];
- }
-
// Create testModule as it would be created by require()
targetModule = new Module(targetPath, parentModulePath);
diff --git a/test/getImportGlobalsSrc.test.js b/test/getImportGlobalsSrc.test.js
index 28ac50c..0c40e5a 100644
--- a/test/getImportGlobalsSrc.test.js
+++ b/test/getImportGlobalsSrc.test.js
@@ -31,12 +31,7 @@ describe("getImportGlobalsSrc", function () {
expectedGlobals = Object.keys(global);
vm.runInNewContext(src, context);
- actualGlobals = Object.keys(context).filter(function (key) {
- // node v0.10 does not set a constructor property on the context
- // node v0.11 does set a constructor property
- // so just lets filter it, because it doesn't make sense to mock it anyway
- return key !== "constructor";
- });
+ actualGlobals = Object.keys(context);
actualGlobals.sort();
expectedGlobals.sort();
expect(actualGlobals).to.eql(expectedGlobals);
@@ -57,12 +52,7 @@ describe("getImportGlobalsSrc", function () {
return ignore.indexOf(value) === -1;
});
vm.runInNewContext(src, context);
- actualGlobals = Object.keys(context).filter(function (key) {
- // node v0.10 does not set a constructor property on the context
- // node v0.11 does set a constructor property
- // so just lets filter it, because it doesn't make sense to mock it anyway
- return key !== "constructor"
- });
+ actualGlobals = Object.keys(context);
actualGlobals.sort();
expectedGlobals.sort();
expect(actualGlobals).to.eql(expectedGlobals);