diff --git a/package.json b/package.json index 08d2b1b1..dc5c493f 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,12 @@ "testMatch": [ "**/tests/unit/**/*.[jt]s?(x)" ], + "testPathIgnorePatterns": [ + "/tests/unit/setup_unit.js" + ], + "setupFiles": [ + "/tests/unit/setup_unit.js" + ], "moduleNameMapper": { "node_helper": "/js/node_helper.js", "logger": "/js/logger.js", diff --git a/tests/e2e/translations_spec.js b/tests/e2e/translations_spec.js index 1be7eca6..d05837cd 100644 --- a/tests/e2e/translations_spec.js +++ b/tests/e2e/translations_spec.js @@ -153,6 +153,7 @@ describe("Translations", function () { describe("Same keys", function () { let base; + let missing = []; beforeAll(function (done) { const dom = new JSDOM( @@ -170,6 +171,10 @@ describe("Translations", function () { }; }); + afterAll(function () { + console.log(missing); + }); + for (let language in translations) { if (language === "en") { continue; @@ -210,7 +215,7 @@ describe("Translations", function () { } catch (e) { if (e.message.match(/expect.*toEqual/)) { const diff = base.filter((key) => !keys.includes(key)); - console.log(`Missing Translations for language ${language}: ${diff}`); + missing.push(`Missing Translations for language ${language}: ${diff}`); } else { throw e; } diff --git a/tests/unit/global_vars/defaults_modules_spec.js b/tests/unit/global_vars/defaults_modules_spec.js index 1c9137ce..08899a2d 100644 --- a/tests/unit/global_vars/defaults_modules_spec.js +++ b/tests/unit/global_vars/defaults_modules_spec.js @@ -4,16 +4,11 @@ const vm = require("vm"); const basedir = path.join(__dirname, "../../.."); -const mockedWarn = () => {}; -const originalWarn = console.log; - beforeAll(function () { const fileName = "js/app.js"; const filePath = path.join(basedir, fileName); const code = fs.readFileSync(filePath); - console.log = mockedWarn; - sandbox = { module: {}, __dirname: path.dirname(filePath), @@ -33,10 +28,6 @@ beforeAll(function () { vm.runInNewContext(code, sandbox, fileName); }); -afterAll(function () { - console.log = originalWarn; -}); - describe("Default modules set in modules/default/defaultmodules.js", function () { const expectedDefaultModules = require("../../../modules/default/defaultmodules"); diff --git a/tests/unit/global_vars/root_path_spec.js b/tests/unit/global_vars/root_path_spec.js index 8cf8b521..249066dc 100644 --- a/tests/unit/global_vars/root_path_spec.js +++ b/tests/unit/global_vars/root_path_spec.js @@ -2,9 +2,6 @@ const fs = require("fs"); const path = require("path"); const vm = require("vm"); -const mockedWarn = () => {}; -const originalWarn = console.log; - beforeAll(function () { const basedir = path.join(__dirname, "../../.."); @@ -12,8 +9,6 @@ beforeAll(function () { const filePath = path.join(basedir, fileName); const code = fs.readFileSync(filePath); - console.log = mockedWarn; - sandbox = { module: {}, __dirname: path.dirname(filePath), @@ -33,10 +28,6 @@ beforeAll(function () { vm.runInNewContext(code, sandbox, fileName); }); -afterAll(function () { - console.log = originalWarn; -}); - describe("'global.root_path' set in js/app.js", function () { const expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"]; diff --git a/tests/unit/setup_unit.js b/tests/unit/setup_unit.js new file mode 100644 index 00000000..b4b7574c --- /dev/null +++ b/tests/unit/setup_unit.js @@ -0,0 +1 @@ +console.log = () => {};