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:
authorJeroen Valcke <valcke_jeroen@hotmail.com>2017-10-20 20:57:30 +0300
committerJeroen Valcke <valcke_jeroen@hotmail.com>2017-10-20 20:57:30 +0300
commitbc5a74cd63200f89e2eb39f3bffbe27950afe63b (patch)
treee56a5a819a8451f2a23b6077eb01a4f697505254 /testLib
parent3960361d3b43cab02cd6c431c92c1c616a387c1f (diff)
Add test to check if __filename and __dirname is correct
Diffstat (limited to 'testLib')
-rw-r--r--testLib/sharedTestCases.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/testLib/sharedTestCases.js b/testLib/sharedTestCases.js
index 5230092..ec5e116 100644
--- a/testLib/sharedTestCases.js
+++ b/testLib/sharedTestCases.js
@@ -414,4 +414,9 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
expect(ES2015Module.getLang()).to.equal("nl");
})
+ it("Should have correct __filename and __dirname when mocked using convertConst", function() {
+ expect(rewire("./ES2015Module", { convertConst: true }).filename).to.equal(require("./ES2015Module").filename);
+ expect(rewire("./ES2015Module", { convertConst: true }).dirname).to.equal(require("./ES2015Module").dirname);
+ })
+
});