mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Fix some eslint issues in the tests
This commit is contained in:
parent
bcff953fbb
commit
53720ae8ae
@ -5,7 +5,7 @@ describe("Clock set to spanish language module", function () {
|
|||||||
|
|
||||||
let app = null;
|
let app = null;
|
||||||
|
|
||||||
testMatch = async function (element, regex) {
|
const testMatch = async function (element, regex) {
|
||||||
await app.client.waitUntilWindowLoaded();
|
await app.client.waitUntilWindowLoaded();
|
||||||
const elem = await app.client.$(element);
|
const elem = await app.client.$(element);
|
||||||
const txt = await elem.getText(element);
|
const txt = await elem.getText(element);
|
||||||
|
@ -6,7 +6,7 @@ describe("Clock module", function () {
|
|||||||
|
|
||||||
let app = null;
|
let app = null;
|
||||||
|
|
||||||
testMatch = async function (element, regex) {
|
const testMatch = async function (element, regex) {
|
||||||
await app.client.waitUntilWindowLoaded();
|
await app.client.waitUntilWindowLoaded();
|
||||||
const elem = await app.client.$(element);
|
const elem = await app.client.$(element);
|
||||||
const txt = await elem.getText(element);
|
const txt = await elem.getText(element);
|
||||||
|
@ -4,39 +4,41 @@ const vm = require("vm");
|
|||||||
|
|
||||||
const basedir = path.join(__dirname, "../../..");
|
const basedir = path.join(__dirname, "../../..");
|
||||||
|
|
||||||
beforeAll(function () {
|
|
||||||
const fileName = "js/app.js";
|
|
||||||
const filePath = path.join(basedir, fileName);
|
|
||||||
const code = fs.readFileSync(filePath);
|
|
||||||
|
|
||||||
sandbox = {
|
|
||||||
module: {},
|
|
||||||
__dirname: path.dirname(filePath),
|
|
||||||
global: {},
|
|
||||||
process: {
|
|
||||||
on: function () {},
|
|
||||||
env: {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sandbox.require = function (filename) {
|
|
||||||
// This modifies the global slightly,
|
|
||||||
// but supplies vm with essential code
|
|
||||||
if (filename === "logger") {
|
|
||||||
return require("../mocks/logger.js");
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
return require(filename);
|
|
||||||
} catch {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.runInNewContext(code, sandbox, fileName);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("Default modules set in modules/default/defaultmodules.js", function () {
|
describe("Default modules set in modules/default/defaultmodules.js", function () {
|
||||||
|
let sandbox = null;
|
||||||
|
|
||||||
|
beforeAll(function () {
|
||||||
|
const fileName = "js/app.js";
|
||||||
|
const filePath = path.join(basedir, fileName);
|
||||||
|
const code = fs.readFileSync(filePath);
|
||||||
|
|
||||||
|
sandbox = {
|
||||||
|
module: {},
|
||||||
|
__dirname: path.dirname(filePath),
|
||||||
|
global: {},
|
||||||
|
process: {
|
||||||
|
on: function () {},
|
||||||
|
env: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sandbox.require = function (filename) {
|
||||||
|
// This modifies the global slightly,
|
||||||
|
// but supplies vm with essential code
|
||||||
|
if (filename === "logger") {
|
||||||
|
return require("../mocks/logger.js");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require(filename);
|
||||||
|
} catch (ignore) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.runInNewContext(code, sandbox, fileName);
|
||||||
|
});
|
||||||
|
|
||||||
const expectedDefaultModules = require("../../../modules/default/defaultmodules");
|
const expectedDefaultModules = require("../../../modules/default/defaultmodules");
|
||||||
|
|
||||||
for (const defaultModule of expectedDefaultModules) {
|
for (const defaultModule of expectedDefaultModules) {
|
||||||
|
@ -2,41 +2,43 @@ const fs = require("fs");
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const vm = require("vm");
|
const vm = require("vm");
|
||||||
|
|
||||||
beforeAll(function () {
|
|
||||||
const basedir = path.join(__dirname, "../../..");
|
|
||||||
|
|
||||||
const fileName = "js/app.js";
|
|
||||||
const filePath = path.join(basedir, fileName);
|
|
||||||
const code = fs.readFileSync(filePath);
|
|
||||||
|
|
||||||
sandbox = {
|
|
||||||
module: {},
|
|
||||||
__dirname: path.dirname(filePath),
|
|
||||||
global: {},
|
|
||||||
process: {
|
|
||||||
on: function () {},
|
|
||||||
env: {}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
sandbox.require = function (filename) {
|
|
||||||
// This modifies the global slightly,
|
|
||||||
// but supplies vm with essential code
|
|
||||||
if (filename === "logger") {
|
|
||||||
return require("../mocks/logger.js");
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
return require(filename);
|
|
||||||
} catch {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.runInNewContext(code, sandbox, fileName);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("'global.root_path' set in js/app.js", function () {
|
describe("'global.root_path' set in js/app.js", function () {
|
||||||
|
let sandbox = null;
|
||||||
|
|
||||||
|
beforeAll(function () {
|
||||||
|
const basedir = path.join(__dirname, "../../..");
|
||||||
|
|
||||||
|
const fileName = "js/app.js";
|
||||||
|
const filePath = path.join(basedir, fileName);
|
||||||
|
const code = fs.readFileSync(filePath);
|
||||||
|
|
||||||
|
sandbox = {
|
||||||
|
module: {},
|
||||||
|
__dirname: path.dirname(filePath),
|
||||||
|
global: {},
|
||||||
|
process: {
|
||||||
|
on: function () {},
|
||||||
|
env: {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sandbox.require = function (filename) {
|
||||||
|
// This modifies the global slightly,
|
||||||
|
// but supplies vm with essential code
|
||||||
|
if (filename === "logger") {
|
||||||
|
return require("../mocks/logger.js");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return require(filename);
|
||||||
|
} catch (ignore) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.runInNewContext(code, sandbox, fileName);
|
||||||
|
});
|
||||||
|
|
||||||
const expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"];
|
const expectedSubPaths = ["modules", "serveronly", "js", "js/app.js", "js/main.js", "js/electron.js", "config"];
|
||||||
|
|
||||||
expectedSubPaths.forEach((subpath) => {
|
expectedSubPaths.forEach((subpath) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user