diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f6856c8..3a0ddfee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ _This release is scheduled to be released on 2025-01-01._ - [linter] re-added `eslint-plugin-import`now that it supports ESLint v9 (#3586) - [docs] Added step for npm publishing in release process (#3595) - [core] Add GitHub workflow to run spellcheck a few days before each release. +- [core] Add intest flag to index.html to pass to module js for test mode detection (needed by #3630) ### Removed diff --git a/index.html b/index.html index 09addfe3..df64a082 100644 --- a/index.html +++ b/index.html @@ -18,6 +18,7 @@ diff --git a/js/app.js b/js/app.js index 5ab23356..9d111c7e 100644 --- a/js/app.js +++ b/js/app.js @@ -13,6 +13,7 @@ const { getEnvVarsAsObj } = require(`${__dirname}/server_functions`); // Get version number. global.version = require(`${__dirname}/../package.json`).version; +global.mmTestMode = process.env.mmTestMode === "true" ? true : false; Log.log(`Starting MagicMirror: v${global.version}`); // Log system information. diff --git a/js/server_functions.js b/js/server_functions.js index 65928d73..07c6df53 100644 --- a/js/server_functions.js +++ b/js/server_functions.js @@ -109,6 +109,7 @@ function geExpectedReceivedHeaders (url) { function getHtml (req, res) { let html = fs.readFileSync(path.resolve(`${global.root_path}/index.html`), { encoding: "utf8" }); html = html.replace("#VERSION#", global.version); + html = html.replace("#TESTMODE#", global.mmTestMode); let configFile = "config/config.js"; if (typeof global.configuration_file !== "undefined") { diff --git a/tests/e2e/helpers/global-setup.js b/tests/e2e/helpers/global-setup.js index ef90c0fd..3155e747 100644 --- a/tests/e2e/helpers/global-setup.js +++ b/tests/e2e/helpers/global-setup.js @@ -26,6 +26,7 @@ exports.startApplication = async (configFilename, exec) => { } else { process.env.MM_CONFIG_FILE = configFilename; } + process.env.mmTestMode = "true"; if (exec) exec; global.app = require("../../../js/app"); diff --git a/tests/electron/helpers/global-setup.js b/tests/electron/helpers/global-setup.js index e7f8faca..505cb5e3 100644 --- a/tests/electron/helpers/global-setup.js +++ b/tests/electron/helpers/global-setup.js @@ -11,6 +11,7 @@ exports.startApplication = async (configFilename, systemDate = null, electronPar if (systemDate) { process.env.MOCK_DATE = systemDate; } + process.env.mmTestMode = "true"; global.electronApp = await electron.launch({ args: electronParams });