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:
Diffstat (limited to 'test/getImportGlobalsSrc.test.js')
-rw-r--r--test/getImportGlobalsSrc.test.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/getImportGlobalsSrc.test.js b/test/getImportGlobalsSrc.test.js
index 065bd59..0d9b020 100644
--- a/test/getImportGlobalsSrc.test.js
+++ b/test/getImportGlobalsSrc.test.js
@@ -19,4 +19,24 @@ describe("getImportGlobalsSrc", function () {
expect(actualGlobals).to.eql(expectedGlobals);
expect(actualGlobals.length).to.be.above(1);
});
+ it("should ignore the given variables", function () {
+ var context = {
+ global: global
+ },
+ ignore = ["console", "setTimeout"],
+ src,
+ actualGlobals,
+ expectedGlobals = Object.keys(global);
+
+ src = getImportGlobalsSrc(ignore);
+ expectedGlobals = expectedGlobals.filter(function filterIgnoredVars(value) {
+ return ignore.indexOf(value) === -1;
+ });
+ vm.runInNewContext(src, context);
+ actualGlobals = Object.keys(context);
+ actualGlobals.sort();
+ expectedGlobals.sort();
+ expect(actualGlobals).to.eql(expectedGlobals);
+ expect(actualGlobals.length).to.be.above(1);
+ });
}); \ No newline at end of file