mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 21:11:17 +00:00
add support for test mode detection in modulename.js via index.html (#3631)
in some cases the modulename.js may need to detect running in test mode (compliments pr #3630) window.name is not set web mode add a new field to the index.html window.intest and use the server_function to replace the hard coded string like we do for window.mmversion=#VERSION# then change the two test helpers to set the env variable app.js detects and sets global.intest=true server func replace with value of global.intest then module can use if(window.intest)
This commit is contained in:
@@ -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.
|
||||
|
@@ -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") {
|
||||
|
Reference in New Issue
Block a user