Merge pull request #2007 from rejas/no_undef

Cleanup eslints no-undef warnings
This commit is contained in:
Michael Teeuw 2020-05-05 14:31:41 +02:00 committed by GitHub
commit 1e7ce8bb5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 84 additions and 91 deletions

View File

@ -6,6 +6,12 @@
"mocha": true, "mocha": true,
"node": true "node": true
}, },
"globals": {
"config": true,
"Log": true,
"MM": true,
"moment": true
},
"parserOptions": { "parserOptions": {
"sourceType": "module", "sourceType": "module",
"ecmaVersion": 2017, "ecmaVersion": 2017,
@ -16,7 +22,6 @@
"rules": { "rules": {
"eqeqeq": "error", "eqeqeq": "error",
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"no-undef": "off",
"no-unused-vars": "off" "no-unused-vars": "off"
} }
} }

View File

@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Replaced grunt-based linters with their non-grunt equivalents - Replaced grunt-based linters with their non-grunt equivalents
- Switch to most of the eslint:recommended rules and fix warnings - Switch to most of the eslint:recommended rules and fix warnings
- Replaced insecure links with https ones - Replaced insecure links with https ones
- Cleaned up all "no-undef" warnings from eslint
### Deleted ### Deleted
- Removed truetype (ttf) fonts - Removed truetype (ttf) fonts

View File

@ -1,9 +1,12 @@
/* global Class, xyz */
/* Simple JavaScript Inheritance /* Simple JavaScript Inheritance
* By John Resig https://johnresig.com/ * By John Resig https://johnresig.com/
*
* Inspired by base2 and Prototype
*
* MIT Licensed. * MIT Licensed.
*/ */
// Inspired by base2 and Prototype
(function () { (function () {
var initializing = false; var initializing = false;
var fnTest = /xyz/.test(function () { xyz; }) ? /\b_super\b/ : /.*/; var fnTest = /xyz/.test(function () { xyz; }) ? /\b_super\b/ : /.*/;

View File

@ -1,4 +1,4 @@
/* exported defaults */ /* global mmPort */
/* Magic Mirror /* Magic Mirror
* Config Defaults * Config Defaults
@ -6,9 +6,8 @@
* By Michael Teeuw https://michaelteeuw.nl * By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed. * MIT Licensed.
*/ */
var port = 8080;
var address = "localhost"; var address = "localhost";
var port = 8080;
if (typeof(mmPort) !== "undefined") { if (typeof(mmPort) !== "undefined") {
port = mmPort; port = mmPort;
} }

View File

@ -1,4 +1,4 @@
/* global config, vendor, MM, Log, Module */ /* global defaultModules, Module, vendor */
/* Magic Mirror /* Magic Mirror
* Module and File loaders. * Module and File loaders.

View File

@ -1,16 +1,12 @@
/* exported Log */
/* Magic Mirror /* Magic Mirror
* Logger * Logger
* This logger is very simple, but needs to be extended.
* This system can eventually be used to push the log messages to an external target.
* *
* By Michael Teeuw https://michaelteeuw.nl * By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed. * MIT Licensed.
*/ */
const Log = (function() {
// This logger is very simple, but needs to be extended.
// This system can eventually be used to push the log messages to an external target.
var Log = (function() {
return { return {
info: Function.prototype.bind.call(console.info, console), info: Function.prototype.bind.call(console.info, console),
log: Function.prototype.bind.call(console.log, console), log: Function.prototype.bind.call(console.log, console),

View File

@ -1,4 +1,4 @@
/* global Log, Loader, Module, config, defaults */ /* global Loader, Module, defaults, Translator */
/* Magic Mirror /* Magic Mirror
* Main System * Main System

View File

@ -1,4 +1,4 @@
/* exported Module */ /* global Class, cloneObject, Loader, MMSocket, nunjucks, Translator */
/* Magic Mirror /* Magic Mirror
* Module Blueprint. * Module Blueprint.
@ -6,7 +6,6 @@
* By Michael Teeuw https://michaelteeuw.nl * By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed. * MIT Licensed.
*/ */
var Module = Class.extend({ var Module = Class.extend({
/********************************************************* /*********************************************************
@ -237,7 +236,7 @@ var Module = Class.extend({
*/ */
socket: function () { socket: function () {
if (typeof this._socket === "undefined") { if (typeof this._socket === "undefined") {
this._socket = this._socket = new MMSocket(this.name); this._socket = new MMSocket(this.name);
} }
var self = this; var self = this;
@ -467,8 +466,8 @@ function cmpVersions(a, b) {
Module.register = function (name, moduleDefinition) { Module.register = function (name, moduleDefinition) {
if (moduleDefinition.requiresVersion) { if (moduleDefinition.requiresVersion) {
Log.log("Check MagicMirror version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + version); Log.log("Check MagicMirror version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + global.version);
if (cmpVersions(version, moduleDefinition.requiresVersion) >= 0) { if (cmpVersions(global.version, moduleDefinition.requiresVersion) >= 0) {
Log.log("Version is ok!"); Log.log("Version is ok!");
} else { } else {
Log.log("Version is incorrect. Skip module: '" + name + "'"); Log.log("Version is incorrect. Skip module: '" + name + "'");

View File

@ -4,12 +4,10 @@
* By Michael Teeuw https://michaelteeuw.nl * By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed. * MIT Licensed.
*/ */
const Class = require("./class.js");
const express = require("express");
var Class = require("./class.js"); var NodeHelper = Class.extend({
var express = require("express");
var path = require("path");
NodeHelper = Class.extend({
init: function() { init: function() {
console.log("Initializing new module helper ..."); console.log("Initializing new module helper ...");
}, },
@ -114,7 +112,6 @@ NodeHelper = Class.extend({
} }
}); });
}); });
} }
}); });
@ -122,4 +119,5 @@ NodeHelper.create = function(moduleDefinition) {
return NodeHelper.extend(moduleDefinition); return NodeHelper.extend(moduleDefinition);
}; };
module.exports = NodeHelper; /*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = NodeHelper;}

View File

@ -71,7 +71,7 @@ var Server = function(config, callback) {
var html = fs.readFileSync(path.resolve(global.root_path + "/index.html"), {encoding: "utf8"}); var html = fs.readFileSync(path.resolve(global.root_path + "/index.html"), {encoding: "utf8"});
html = html.replace("#VERSION#", global.version); html = html.replace("#VERSION#", global.version);
configFile = "config/config.js"; var configFile = "config/config.js";
if (typeof(global.configuration_file) !== "undefined") { if (typeof(global.configuration_file) !== "undefined") {
configFile = global.configuration_file; configFile = global.configuration_file;
} }

View File

@ -1,3 +1,11 @@
/* global io */
/* Magic Mirror
* TODO add description
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
var MMSocket = function(moduleName) { var MMSocket = function(moduleName) {
var self = this; var self = this;

View File

@ -1,4 +1,4 @@
/* exported Translator */ /* global translations */
/* Magic Mirror /* Magic Mirror
* Translator (l10n) * Translator (l10n)

View File

@ -1,12 +1,9 @@
/* exported Utils */
/* Magic Mirror /* Magic Mirror
* Utils * Utils
* *
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed. * MIT Licensed.
*/ */
var colors = require("colors/safe"); var colors = require("colors/safe");
var Utils = { var Utils = {

View File

@ -1,4 +1,4 @@
/* global Module */ /* global Module, NotificationFx */
/* Magic Mirror /* Magic Mirror
* Module: alert * Module: alert

View File

@ -1,4 +1,4 @@
/* global Module */ /* global cloneObject, Module */
/* Magic Mirror /* Magic Mirror
* Module: Calendar * Module: Calendar

View File

@ -5,8 +5,8 @@
* MIT Licensed. * MIT Licensed.
*/ */
var ical = require("./vendor/ical.js"); const ical = require("./vendor/ical.js");
var moment = require("moment"); const moment = require("moment");
var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, includePastEvents) { var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, includePastEvents) {
var self = this; var self = this;
@ -25,7 +25,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
clearTimeout(reloadTimer); clearTimeout(reloadTimer);
reloadTimer = null; reloadTimer = null;
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]); var nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
var opts = { var opts = {
headers: { headers: {
"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)" "User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"
@ -61,7 +61,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
} }
// console.log(data); // console.log(data);
newEvents = []; var newEvents = [];
// limitFunction doesn't do much limiting, see comment re: the dates array in rrule section below as to why we need to do the filtering ourselves // limitFunction doesn't do much limiting, see comment re: the dates array in rrule section below as to why we need to do the filtering ourselves
var limitFunction = function(date, i) {return true;}; var limitFunction = function(date, i) {return true;};
@ -97,7 +97,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
if (typeof event.end !== "undefined") { if (typeof event.end !== "undefined") {
endDate = eventDate(event, "end"); endDate = eventDate(event, "end");
} else if(typeof event.duration !== "undefined") { } else if(typeof event.duration !== "undefined") {
dur=moment.duration(event.duration); var dur=moment.duration(event.duration);
endDate = startDate.clone().add(dur); endDate = startDate.clone().add(dur);
} else { } else {
if (!isFacebookBirthday) { if (!isFacebookBirthday) {

View File

@ -15,8 +15,6 @@ var maximumEntries = 10;
var maximumNumberOfDays = 365; var maximumNumberOfDays = 365;
var user = "magicmirror"; var user = "magicmirror";
var pass = "MyStrongPass"; var pass = "MyStrongPass";
var broadcastPastEvents = false;
var auth = { var auth = {
user: user, user: user,
pass: pass pass: pass
@ -24,7 +22,7 @@ var auth = {
console.log("Create fetcher ..."); console.log("Create fetcher ...");
fetcher = new CalendarFetcher(url, fetchInterval, [], maximumEntries, maximumNumberOfDays, auth); var fetcher = new CalendarFetcher(url, fetchInterval, [], maximumEntries, maximumNumberOfDays, auth);
fetcher.onReceive(function(fetcher) { fetcher.onReceive(function(fetcher) {
console.log(fetcher.events()); console.log(fetcher.events());

View File

@ -1,4 +1,4 @@
/* global Log, Module, moment, config */ /* global Module, SunCalc */
/* Magic Mirror /* Magic Mirror
* Module: Clock * Module: Clock
@ -289,11 +289,12 @@ Module.register("clock",{
// Both clocks have been configured, check position // Both clocks have been configured, check position
var placement = this.config.analogPlacement; var placement = this.config.analogPlacement;
analogWrapper = document.createElement("div"); var analogWrapper = document.createElement("div");
analogWrapper.id = "analog"; analogWrapper.id = "analog";
analogWrapper.style.cssFloat = "none"; analogWrapper.style.cssFloat = "none";
analogWrapper.appendChild(clockCircle); analogWrapper.appendChild(clockCircle);
digitalWrapper = document.createElement("div");
var digitalWrapper = document.createElement("div");
digitalWrapper.id = "digital"; digitalWrapper.id = "digital";
digitalWrapper.style.cssFloat = "none"; digitalWrapper.style.cssFloat = "none";
digitalWrapper.appendChild(dateWrapper); digitalWrapper.appendChild(dateWrapper);

View File

@ -1,4 +1,4 @@
/* global Log, Module, moment */ /* global Module */
/* Magic Mirror /* Magic Mirror
* Module: Compliments * Module: Compliments
@ -127,7 +127,7 @@ Module.register("compliments", {
compliments.push.apply(compliments, this.config.compliments.anytime); compliments.push.apply(compliments, this.config.compliments.anytime);
for (entry in this.config.compliments) { for (var entry in this.config.compliments) {
if (new RegExp(entry).test(date)) { if (new RegExp(entry).test(date)) {
compliments.push.apply(compliments, this.config.compliments[entry]); compliments.push.apply(compliments, this.config.compliments[entry]);
} }
@ -188,7 +188,7 @@ Module.register("compliments", {
// create a span to hold it all // create a span to hold it all
var compliment = document.createElement("span"); var compliment = document.createElement("span");
// process all the parts of the compliment text // process all the parts of the compliment text
for (part of parts){ for (var part of parts){
// create a text element for each part // create a text element for each part
compliment.appendChild(document.createTextNode(part)); compliment.appendChild(document.createTextNode(part));
// add a break ` // add a break `

View File

@ -81,8 +81,8 @@ var Fetcher = function(url, reloadInterval, encoding, logFeedWarnings) {
scheduleTimer(); scheduleTimer();
}); });
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]); var nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
headers = {"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)", var headers = {"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)",
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate", "Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
"Pragma": "no-cache"}; "Pragma": "no-cache"};

View File

@ -126,7 +126,7 @@ Module.register("newsfeed",{
if (this.config.removeStartTags === "title" || this.config.removeStartTags === "both") { if (this.config.removeStartTags === "title" || this.config.removeStartTags === "both") {
for (f=0; f<this.config.startTags.length;f++) { for (let f=0; f<this.config.startTags.length;f++) {
if (this.newsItems[this.activeItem].title.slice(0,this.config.startTags[f].length) === this.config.startTags[f]) { if (this.newsItems[this.activeItem].title.slice(0,this.config.startTags[f].length) === this.config.startTags[f]) {
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].title.length); this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].title.length);
} }
@ -137,7 +137,7 @@ Module.register("newsfeed",{
if (this.config.removeStartTags === "description" || this.config.removeStartTags === "both") { if (this.config.removeStartTags === "description" || this.config.removeStartTags === "both") {
if (this.isShowingDescription) { if (this.isShowingDescription) {
for (f=0; f<this.config.startTags.length;f++) { for (let f=0; f<this.config.startTags.length;f++) {
if (this.newsItems[this.activeItem].description.slice(0,this.config.startTags[f].length) === this.config.startTags[f]) { if (this.newsItems[this.activeItem].description.slice(0,this.config.startTags[f].length) === this.config.startTags[f]) {
this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].description.length); this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].description.length);
} }
@ -149,14 +149,14 @@ Module.register("newsfeed",{
//Remove selected tags from the end of rss feed items (title or description) //Remove selected tags from the end of rss feed items (title or description)
if (this.config.removeEndTags) { if (this.config.removeEndTags) {
for (f=0; f<this.config.endTags.length;f++) { for (let f=0; f<this.config.endTags.length;f++) {
if (this.newsItems[this.activeItem].title.slice(-this.config.endTags[f].length)===this.config.endTags[f]) { if (this.newsItems[this.activeItem].title.slice(-this.config.endTags[f].length)===this.config.endTags[f]) {
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(0,-this.config.endTags[f].length); this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(0,-this.config.endTags[f].length);
} }
} }
if (this.isShowingDescription) { if (this.isShowingDescription) {
for (f=0; f<this.config.endTags.length;f++) { for (let f=0; f<this.config.endTags.length;f++) {
if (this.newsItems[this.activeItem].description.slice(-this.config.endTags[f].length)===this.config.endTags[f]) { if (this.newsItems[this.activeItem].description.slice(-this.config.endTags[f].length)===this.config.endTags[f]) {
this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(0,-this.config.endTags[f].length); this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(0,-this.config.endTags[f].length);
} }
@ -331,7 +331,7 @@ Module.register("newsfeed",{
self.sendNotification("NEWS_FEED", {items: self.newsItems}); self.sendNotification("NEWS_FEED", {items: self.newsItems});
} }
timer = setInterval(function() { this.timer = setInterval(function() {
self.activeItem++; self.activeItem++;
self.updateDom(self.config.animationSpeed); self.updateDom(self.config.animationSpeed);
@ -360,7 +360,7 @@ Module.register("newsfeed",{
// reset bottom bar alignment // reset bottom bar alignment
document.getElementsByClassName("region bottom bar")[0].style.bottom = "0"; document.getElementsByClassName("region bottom bar")[0].style.bottom = "0";
document.getElementsByClassName("region bottom bar")[0].style.top = "inherit"; document.getElementsByClassName("region bottom bar")[0].style.top = "inherit";
if(!timer){ if(!this.timer){
this.scheduleUpdateInterval(); this.scheduleUpdateInterval();
} }
}, },
@ -433,10 +433,9 @@ Module.register("newsfeed",{
document.getElementsByClassName("region bottom bar")[0].style.bottom = "inherit"; document.getElementsByClassName("region bottom bar")[0].style.bottom = "inherit";
document.getElementsByClassName("region bottom bar")[0].style.top = "-90px"; document.getElementsByClassName("region bottom bar")[0].style.top = "-90px";
} }
clearInterval(timer); clearInterval(this.timer);
timer = null; this.timer = null;
Log.info(this.name + " - showing " + this.isShowingDescription ? "article description" : "full article"); Log.info(this.name + " - showing " + this.isShowingDescription ? "article description" : "full article");
this.updateDom(100); this.updateDom(100);
} }
}); });

View File

@ -24,7 +24,7 @@ module.exports = NodeHelper.create({
var promises = []; var promises = [];
for (moduleName in modules) { for (var moduleName in modules) {
if (!this.ignoreUpdateChecking(moduleName)) { if (!this.ignoreUpdateChecking(moduleName)) {
// Default modules are included in the main MagicMirror repo // Default modules are included in the main MagicMirror repo
var moduleFolder = path.normalize(__dirname + "/../../" + moduleName); var moduleFolder = path.normalize(__dirname + "/../../" + moduleName);

View File

@ -74,8 +74,8 @@ Module.register("updatenotification", {
var wrapper = document.createElement("div"); var wrapper = document.createElement("div");
if(this.suspended === false){ if(this.suspended === false){
// process the hash of module info found // process the hash of module info found
for(key of Object.keys(this.moduleList)){ for(var key of Object.keys(this.moduleList)){
let m= this.moduleList[key]; let m = this.moduleList[key];
var message = document.createElement("div"); var message = document.createElement("div");
message.className = "small bright"; message.className = "small bright";

29
package-lock.json generated
View File

@ -2599,9 +2599,9 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
}, },
"fsevents": { "fsevents": {
"version": "2.1.2", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
"integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
"dev": true, "dev": true,
"optional": true "optional": true
}, },
@ -4084,9 +4084,9 @@
} }
}, },
"markdownlint": { "markdownlint": {
"version": "0.20.1", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.20.1.tgz", "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.20.2.tgz",
"integrity": "sha512-jq1qt0QkzY6AiN6O3tq+8SmUlvKfhx9GRKBn/IWEuN6RM5xBZG47rfW9Fn0eRvuozf5Xc59dRaLUZEO0XiyGOg==", "integrity": "sha512-TU/SgsylEzp9oAj9dGGZ6009yJq48GpEAeYIsREje5NuvadzO12qvl4wV21vHIerdPy/aSEyM2e9c+CzWq6Reg==",
"dev": true, "dev": true,
"requires": { "requires": {
"markdown-it": "10.0.0" "markdown-it": "10.0.0"
@ -4325,9 +4325,9 @@
} }
}, },
"mocha": { "mocha": {
"version": "7.1.1", "version": "7.1.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.1.tgz", "resolved": "https://registry.npmjs.org/mocha/-/mocha-7.1.2.tgz",
"integrity": "sha512-3qQsu3ijNS3GkWcccT5Zw0hf/rWvu1fTN9sPvEd81hlwsr30GX2GcDSSoBxo24IR8FelmrAydGC6/1J5QQP4WA==", "integrity": "sha512-o96kdRKMKI3E8U0bjnfqW4QMk12MwZ4mhdBTf+B5a1q9+aq2HRnj+3ZdJu0B/ZhJeK78MgYuv6L8d/rA5AeBJA==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-colors": "3.2.3", "ansi-colors": "3.2.3",
@ -4343,7 +4343,7 @@
"js-yaml": "3.13.1", "js-yaml": "3.13.1",
"log-symbols": "3.0.0", "log-symbols": "3.0.0",
"minimatch": "3.0.4", "minimatch": "3.0.4",
"mkdirp": "0.5.3", "mkdirp": "0.5.5",
"ms": "2.1.1", "ms": "2.1.1",
"node-environment-flags": "1.0.6", "node-environment-flags": "1.0.6",
"object.assign": "4.1.0", "object.assign": "4.1.0",
@ -4431,15 +4431,6 @@
"path-exists": "^3.0.0" "path-exists": "^3.0.0"
} }
}, },
"mkdirp": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
"integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
},
"ms": { "ms": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",

View File

@ -50,9 +50,9 @@
"danger": "^3.1.3", "danger": "^3.1.3",
"http-auth": "^3.2.3", "http-auth": "^3.2.3",
"jsdom": "^11.6.2", "jsdom": "^11.6.2",
"markdownlint": "^0.20.1", "markdownlint": "^0.20.2",
"markdownlint-cli": "^0.22.0", "markdownlint-cli": "^0.22.0",
"mocha": "^7.1.1", "mocha": "^7.1.2",
"mocha-each": "^2.0.1", "mocha-each": "^2.0.1",
"mocha-logger": "^1.0.6", "mocha-logger": "^1.0.6",
"spectron": "^8.0.0", "spectron": "^8.0.0",

View File

@ -8,6 +8,7 @@ const describe = global.describe;
describe("All font files from roboto.css should be downloadable", function() { describe("All font files from roboto.css should be downloadable", function() {
helpers.setupTimeout(this); helpers.setupTimeout(this);
var app;
var fontFiles = []; var fontFiles = [];
// Statements below filters out all 'url' lines in the CSS file // Statements below filters out all 'url' lines in the CSS file
var fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8"); var fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");

View File

@ -28,7 +28,7 @@ describe("Position of modules", function () {
var position; var position;
var className; var className;
for (idx in positions) { for (var idx in positions) {
position = positions[idx]; position = positions[idx];
className = position.replace("_", "."); className = position.replace("_", ".");
it("show text in " + position, function () { it("show text in " + position, function () {

View File

@ -6,7 +6,6 @@ const describe = global.describe;
const it = global.it; const it = global.it;
const before = global.before; const before = global.before;
const after = global.after; const after = global.after;
const mlog = require("mocha-logger");
describe("Vendors", function () { describe("Vendors", function () {
@ -30,7 +29,7 @@ describe("Vendors", function () {
var vendors = require(__dirname + "/../../vendor/vendor.js"); var vendors = require(__dirname + "/../../vendor/vendor.js");
Object.keys(vendors).forEach(vendor => { Object.keys(vendors).forEach(vendor => {
it(`should return 200 HTTP code for vendor "${vendor}"`, function () { it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
urlVendor = "http://localhost:8080/vendor/" + vendors[vendor]; var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
request.get(urlVendor, function (err, res, body) { request.get(urlVendor, function (err, res, body) {
expect(res.statusCode).to.equal(200); expect(res.statusCode).to.equal(200);
}); });
@ -39,7 +38,7 @@ describe("Vendors", function () {
Object.keys(vendors).forEach(vendor => { Object.keys(vendors).forEach(vendor => {
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function() { it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function() {
urlVendor = "http://localhost:8080/" + vendors[vendor]; var urlVendor = "http://localhost:8080/" + vendors[vendor];
request.get(urlVendor, function (err, res, body) { request.get(urlVendor, function (err, res, body) {
expect(res.statusCode).to.equal(404); expect(res.statusCode).to.equal(404);
}); });

View File

@ -19,7 +19,8 @@ app.use(auth.connect(basic));
// Set available directories // Set available directories
var directories = ["/tests/configs"]; var directories = ["/tests/configs"];
var directory; var directory;
rootPath = path.resolve(__dirname + "/../../"); var rootPath = path.resolve(__dirname + "/../../");
for (var i in directories) { for (var i in directories) {
directory = directories[i]; directory = directories[i];
app.use(directory, express.static(path.resolve(rootPath + directory))); app.use(directory, express.static(path.resolve(rootPath + directory)));

3
vendor/vendor.js vendored
View File

@ -1,12 +1,9 @@
/* exported vendor */
/* Magic Mirror /* Magic Mirror
* Vendor File Definition * Vendor File Definition
* *
* By Michael Teeuw https://michaelteeuw.nl * By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed. * MIT Licensed.
*/ */
var vendor = { var vendor = {
"moment.js" : "node_modules/moment/min/moment-with-locales.js", "moment.js" : "node_modules/moment/min/moment-with-locales.js",
"moment-timezone.js" : "node_modules/moment-timezone/builds/moment-timezone-with-data.js", "moment-timezone.js" : "node_modules/moment-timezone/builds/moment-timezone-with-data.js",