diff options
author | Rens Baardman <git@rensbaardman.nl> | 2019-06-11 15:11:16 +0300 |
---|---|---|
committer | Rens Baardman <git@rensbaardman.nl> | 2019-06-11 16:10:52 +0300 |
commit | d3cbd02b3d9de6cbfb518c31f9c70472508912c3 (patch) | |
tree | ecd26e185f120d8d9a1b6b1dcc15f692ac1eac08 /test | |
parent | 5bea3d816d0258e5204f1b49b08b9fb302ac53e1 (diff) |
Change line endings from carriage returns to line feedschange-carriage-returns
Diffstat (limited to 'test')
-rw-r--r-- | test/getImportGlobalsSrc.test.js | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/test/getImportGlobalsSrc.test.js b/test/getImportGlobalsSrc.test.js index 0c40e5a..b85736c 100644 --- a/test/getImportGlobalsSrc.test.js +++ b/test/getImportGlobalsSrc.test.js @@ -1,61 +1,61 @@ -var expect = require("expect.js"),
- vm = require("vm"),
- getImportGlobalsSrc = require("../lib/getImportGlobalsSrc.js");
-
-describe("getImportGlobalsSrc", function () {
- it("should declare all globals with a var", function () {
- var context = {
- global: global
- },
- expectedGlobals,
- src,
- actualGlobals;
-
- // Temporarily set module-internal variables on the global scope to check if getImportGlobalsSrc()
- // ignores them properly
- global.module = module;
- global.exports = exports;
- global.require = require;
-
- // Also make sure it ignores invalid variable names
- global['a-b'] = true;
-
- src = getImportGlobalsSrc();
-
- delete global.module;
- delete global.exports;
- delete global.require;
- delete global['__core-js_shared__'];
- delete global['a-b'];
-
- expectedGlobals = Object.keys(global);
-
- vm.runInNewContext(src, context);
- actualGlobals = Object.keys(context);
- actualGlobals.sort();
- expectedGlobals.sort();
- 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);
-
- // getImportGlobalsSrc modifies the ignore array, so let's create a copy
- src = getImportGlobalsSrc(ignore.slice(0));
- 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);
- });
-});
+var expect = require("expect.js"), + vm = require("vm"), + getImportGlobalsSrc = require("../lib/getImportGlobalsSrc.js"); + +describe("getImportGlobalsSrc", function () { + it("should declare all globals with a var", function () { + var context = { + global: global + }, + expectedGlobals, + src, + actualGlobals; + + // Temporarily set module-internal variables on the global scope to check if getImportGlobalsSrc() + // ignores them properly + global.module = module; + global.exports = exports; + global.require = require; + + // Also make sure it ignores invalid variable names + global['a-b'] = true; + + src = getImportGlobalsSrc(); + + delete global.module; + delete global.exports; + delete global.require; + delete global['__core-js_shared__']; + delete global['a-b']; + + expectedGlobals = Object.keys(global); + + vm.runInNewContext(src, context); + actualGlobals = Object.keys(context); + actualGlobals.sort(); + expectedGlobals.sort(); + 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); + + // getImportGlobalsSrc modifies the ignore array, so let's create a copy + src = getImportGlobalsSrc(ignore.slice(0)); + 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); + }); +}); |