Release 2.27.0 (#3410)

## [2.27.0] - 2024-04-01

Thanks to: @bugsounet, @crazyscot, @illimarkangur, @jkriegshauser,
@khassel, @KristjanESPERANTO, @Paranoid93, @rejas, @sdetweil and
@vppencilsharpener.

This release marks the first release without Michael Teeuw (@michmich).
A very special thanks to him for creating MagicMirror and leading the
project for so many years.

For more info, please read the following post: [A New Chapter for
MagicMirror: The Community Takes the
Lead](https://forum.magicmirror.builders/topic/18329/a-new-chapter-for-magicmirror-the-community-takes-the-lead).

### Added

- Output of system information to the console for troubleshooting (#3328
and #3337), ignore errors under aarch64 (#3349)
- [chore] Add `eslint-plugin-package-json` to lint the `package.json`
files (#3368)
- [weather] `showHumidity` config is now a string describing where to
show this element. Supported values: "wind", "temp", "feelslike",
"below", "none". (#3330)
- electron-rebuild test suite for electron and 3rd party modules
compatibility (#3392)
- Create MM² icon and attach it to electron process (#3407)

### Updated

- Update updatenotification (update_helper.js): Recode with pm2 library
(#3332)
- Removing lodash dependency by replacing merge by spread operator
(#3339)
- Use node prefix for build-in modules (#3340)
- Rework logging colors (#3350)
- Update pm2 to v5.3.1 with no allow-ghsas (#3364)
- [chore] Update husky and let lint-staged fix ESLint issues
- [chore] Update dependencies including electron to v29 (#3357) and
node-ical
- Update translations for estonian (#3371)
- Update electron to v29 and update other dependencies
- [calendar] fullDay events over several days now show the left days
from the first day on and 'today' on the last day
- Update layout of current weather indoor values

### Fixed

- Correct apibase of weathergov weatherprovider to match documentation
(#2926)
- Worked around several issues in the RRULE library that were causing
deleted calender events to still show, some
initial and recurring events to not show, and some event times to be off
an hour. (#3291)
- Skip changelog requirement when running tests for dependency updates
(#3320)
- Display precipitation probability when it is 0% instead of blank/empty
(#3345)
- [newsfeed] Suppress unsightly animation cases when there are 0 or 1
active news items (#3336)
- [newsfeed] Always compute the feed item URL using the same helper
function (#3336)
- Ignore all custom css files (#3359)
- [newsfeed] Fix newsfeed stall issue introduced by #3336 (#3361)
- Changed `log.debug` to `log.log` in `app.js` where logLevel is not set
because config is not loaded at this time (#3353)
- [calendar] deny fetch interval < 60000 and set 60000 in this case
(prevent fetch loop failed) (#3382)
- added message in case where config.js is missing the module.export
line PR #3383
- Fixed an issue where recurring events could extend past their
recurrence end date (#3393)
- Don't display any `npm WARN <....>` on install (#3399)
- Fixed move suncalc dependency to production from dev, as it is used by
clock module
- [compliments] Fix mirror not responding anymore when no compliments
are to be shown (#3385)

### Deleted

- Unneeded file headers (#3358)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Michael Teeuw <michael@xonaymedia.nl>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Ross Younger <crazyscot@gmail.com>
Co-authored-by: Bugsounet - Cédric <github@bugsounet.fr>
Co-authored-by: jkriegshauser <joshuakr@nvidia.com>
Co-authored-by: illimarkangur <116028111+illimarkangur@users.noreply.github.com>
Co-authored-by: sam detweiler <sdetweil@gmail.com>
Co-authored-by: vppencilsharpener <tim.pray@gmail.com>
Co-authored-by: Paranoid93 <6515818+Paranoid93@users.noreply.github.com>
This commit is contained in:
Veeck
2024-04-01 22:03:20 +02:00
committed by GitHub
parent 118e21238c
commit 5ea8a3469a
173 changed files with 4025 additions and 2474 deletions

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test default config for modules
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
exports.configFactory = (options) => {
return Object.assign(
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config sample ipWhitelist
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = require(`${process.cwd()}/tests/configs/default.js`).configFactory({
ipWhitelist: [],
port: 8282

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config sample module alert
*
* By rejas
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default calendar with auth by default
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test ics with out of date event causing bad return from rrule.between
*
* By Sam Detweiler
* MIT Licensed.
*/
let config = {
timeFormat: 12,
logLevel: ["INFO", "LOG", "WARN", "ERROR", "DEBUG"],

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default calendar
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default calendar with auth by default
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config custom calendar
*
* By Rejas
* MIT Licensed.
*/
let config = {
timeFormat: 12,
@@ -12,6 +7,7 @@ let config = {
position: "bottom_bar",
config: {
customEvents: [{ keyword: "CustomEvent", symbol: "dice", eventClass: "undo" }],
forceUseCurrentTime: true,
calendars: [
{
maximumEntries: 5,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default calendar
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -3,11 +3,8 @@
* By jkriegshauser
* MIT Licensed.
*
* NOTE: calendar_test_exdate.ics has exdate entries for the next 20 years, but without some
* way to set a debug date for tests, this test may become flaky on specific days (i.e. could
* not test easily on leap-years, the BYDAY specified in exdate, etc.) or when the 20 years
* elapses if this project is still in active development ;)
* See issue #3250
* See tests/electron/modules/calendar_spec.js
*/
let config = {
timeFormat: 12,
@@ -21,8 +18,8 @@ let config = {
calendars: [
{
maximumEntries: 100,
maximumNumberOfDays: 364,
url: "http://localhost:8080/tests/mocks/calendar_test_exdate.ics"
maximumNumberOfDays: 28, // 4 weeks, 2 of which are skipped
url: "http://localhost:8080/tests/mocks/exdate_la_at_midnight_dst.ics"
}
]
}
@@ -30,6 +27,10 @@ let config = {
]
};
Date.now = () => {
return new Date("19 Oct 2023 12:30:00 GMT-07:00").valueOf();
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;

View File

@@ -0,0 +1,37 @@
/* MagicMirror² Test calendar exdate
*
* By jkriegshauser
* MIT Licensed.
*
* See issue #3250
* See tests/electron/modules/calendar_spec.js
*/
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
maximumEntries: 100,
calendars: [
{
maximumEntries: 100,
maximumNumberOfDays: 28, // 4 weeks, 2 of which are skipped
url: "http://localhost:8080/tests/mocks/exdate_la_at_midnight_std.ics"
}
]
}
}
]
};
Date.now = () => {
return new Date("19 Oct 2023 12:30:00 GMT-07:00").valueOf();
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -0,0 +1,37 @@
/* MagicMirror² Test calendar exdate
*
* By jkriegshauser
* MIT Licensed.
*
* See issue #3250
* See tests/electron/modules/calendar_spec.js
*/
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
maximumEntries: 100,
calendars: [
{
maximumEntries: 100,
maximumNumberOfDays: 28, // 4 weeks, 2 of which are skipped
url: "http://localhost:8080/tests/mocks/exdate_la_before_midnight.ics"
}
]
}
}
]
};
Date.now = () => {
return new Date("19 Oct 2023 12:30:00 GMT-07:00").valueOf();
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -0,0 +1,37 @@
/* MagicMirror² Test calendar exdate
*
* By jkriegshauser
* MIT Licensed.
*
* See issue #3250
* See tests/electron/modules/calendar_spec.js
*/
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
maximumEntries: 100,
calendars: [
{
maximumEntries: 100,
maximumNumberOfDays: 28, // 4 weeks, 2 of which are skipped
url: "http://localhost:8080/tests/mocks/exdate_syd_at_midnight_dst.ics"
}
]
}
}
]
};
Date.now = () => {
return new Date("14 Sep 2023 12:30:00 GMT+10:00").valueOf();
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -0,0 +1,37 @@
/* MagicMirror² Test calendar exdate
*
* By jkriegshauser
* MIT Licensed.
*
* See issue #3250
* See tests/electron/modules/calendar_spec.js
*/
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
maximumEntries: 100,
calendars: [
{
maximumEntries: 100,
maximumNumberOfDays: 28, // 4 weeks, 2 of which are skipped
url: "http://localhost:8080/tests/mocks/exdate_syd_at_midnight_std.ics"
}
]
}
}
]
};
Date.now = () => {
return new Date("14 Sep 2023 12:30:00 GMT+10:00").valueOf();
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -0,0 +1,37 @@
/* MagicMirror² Test calendar exdate
*
* By jkriegshauser
* MIT Licensed.
*
* See issue #3250
* See tests/electron/modules/calendar_spec.js
*/
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
maximumEntries: 100,
calendars: [
{
maximumEntries: 100,
maximumNumberOfDays: 28, // 4 weeks, 2 of which are skipped
url: "http://localhost:8080/tests/mocks/exdate_syd_before_midnight.ics"
}
]
}
}
]
};
Date.now = () => {
return new Date("14 Sep 2023 12:30:00 GMT+10:00").valueOf();
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -1,10 +1,3 @@
/* MagicMirror² Test calendar calendar
*
* This configuration is a wrong authentication
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -0,0 +1,28 @@
/* MagicMirror² Test config for fullday calendar entries over multiple days
*
* By Paranoid93 https://github.com/Paranoid93/
* MIT Licensed.
*/
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
calendars: [
{
maximumNumberOfDays: 2,
url: "http://localhost:8080/tests/mocks/calendar_test_multi_day_starting_today.ics"
}
]
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default calendar
* with authentication old config
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config custom calendar
*
* By Rejas
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -0,0 +1,30 @@
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
hideDuplicates: false,
maximumEntries: 100,
calendars: [
{
maximumEntries: 100,
maximumNumberOfDays: 1, // Just today
url: "http://localhost:8080/tests/mocks/rrule_until.ics"
}
]
}
}
]
};
Date.now = () => {
return new Date("07 Mar 2024 10:38:00 GMT-07:00").valueOf();
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for multiple calendar events having the same name and start date/time
*
* By Paranoid93 https://github.com/Paranoid93/
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -0,0 +1,28 @@
/* MagicMirror² Test config for fullday calendar entries over multiple days
*
* By Paranoid93 https://github.com/Paranoid93/
* MIT Licensed.
*/
let config = {
timeFormat: 12,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
calendars: [
{
maximumNumberOfDays: 2,
url: "http://localhost:8080/tests/mocks/calendar_test_full_day_events.ics"
}
]
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {
module.exports = config;
}

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Sergey Morozov
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Sergey Morozov
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,7 +1,3 @@
/* MagicMirror² Test config for analog clock face
*
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Johan Hammar
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Sergey Morozov
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Johan Hammar
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Johan Hammar
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Johan Hammar
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
language: "es",
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
language: "es",

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
language: "es",
timeFormat: 12,

View File

@@ -1,9 +1,3 @@
/* MagicMirror² Test config for default clock module
* Language es for showWeek feature
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
language: "es",
timeFormat: 12,

View File

@@ -1,9 +1,3 @@
/* MagicMirror² Test config sample for AnimateCSS integration with compliments module
*
* By bugsounet https://github.com/bugsounet
* 09/2023
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,10 +1,3 @@
/* MagicMirror² Test config sample for AnimateCSS integration with compliments module
* --> if animation name is not an AnimateCSS animation
* --> must fallback to default (no animation)
* By bugsounet https://github.com/bugsounet
* 09/2023
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,9 +1,3 @@
/* MagicMirror² Test config sample for AnimateCSS integration with compliments module
* --> inversed name animation : in for out and vice versa (must return no animation)
* By bugsounet https://github.com/bugsounet
* 09/2023
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config compliments with anytime type
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config compliments with date type
*
* By Rejas
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config compliments with anytime type
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for default compliments
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config compliments with remote file
*
* By Rejas
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for display setters module using the helloworld module
*
* By Rejas
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config sample module hello world
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config sample module hello world default config
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config newsfeed module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,7 +1,3 @@
/* MagicMirror² Test config newsfeed module
*
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,7 +1,3 @@
/* MagicMirror² Test config newsfeed module
*
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,7 +1,3 @@
/* MagicMirror² Test config newsfeed module
*
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config for position setters module using the helloworld module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
modules:
// Using exotic content. This is why don't accept go to JSON configuration file

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config current weather compliments
*
* By rejas https://github.com/rejas
* MIT Licensed.
*/
let config = {
modules: [
{

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default weather
*
* By fewieden https://github.com/fewieden
* MIT Licensed.
*/
let config = {
timeFormat: 12,
@@ -12,6 +7,7 @@ let config = {
position: "bottom_bar",
config: {
location: "Munich",
showHumidity: "feelslike",
mockData: '"#####WEATHERDATA#####"'
}
}

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default weather
*
* By fewieden https://github.com/fewieden
* MIT Licensed.
*/
let config = {
modules: [
{
@@ -14,7 +9,7 @@ let config = {
windUnits: "beaufort",
showWindDirectionAsArrow: true,
showSun: false,
showHumidity: true,
showHumidity: "wind",
roundTemp: true,
degreeLabel: true
}

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default weather
*
* By fewieden https://github.com/fewieden
* MIT Licensed.
*/
let config = {
units: "imperial",
@@ -14,7 +9,7 @@ let config = {
location: "Munich",
mockData: '"#####WEATHERDATA#####"',
decimalSymbol: ",",
showHumidity: true
showHumidity: "wind"
}
}
]

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default weather
*
* By fewieden https://github.com/fewieden
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default weather
*
* By fewieden https://github.com/fewieden
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default weather
*
* By fewieden https://github.com/fewieden
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config default weather
*
* By rejas
* MIT Licensed.
*/
let config = {
units: "imperial",

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config hourly weather
*
* By rejas https://github.com/rejas
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config hourly weather options
*
* By rejas https://github.com/rejas
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config hourly weather
*
* By rejas https://github.com/rejas
* MIT Licensed.
*/
let config = {
timeFormat: 12,

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config sample ipWhitelist
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = require(`${process.cwd()}/tests/configs/default.js`).configFactory({
ipWhitelist: ["x.x.x.x"],
port: 8181

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config sample environment set port 8090
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = require(`${process.cwd()}/tests/configs/default.js`).configFactory({
port: 8090
});

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test config sample environment set port 8090
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = require(`${process.cwd()}/tests/configs/default.js`).configFactory({
port: ${MM_PORT}
});

View File

@@ -1,8 +1,3 @@
/* MagicMirror² Test default config for modules
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
let config = {
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.10.1"]
};

View File

@@ -1,10 +1,3 @@
/* AnimateCSS integration Test with compliments module
*
* By bugsounet https://github.com/bugsounet
* and helped by khassel
* 09/2023
* MIT Licensed.
*/
const helpers = require("./helpers/global-setup");
describe("AnimateCSS integration Test", () => {

View File

@@ -3,7 +3,7 @@ const helpers = require("./helpers/global-setup");
describe("All font files from roboto.css should be downloadable", () => {
const fontFiles = [];
// Statements below filters out all 'url' lines in the CSS file
const fileContent = require("fs").readFileSync(`${__dirname}/../../fonts/roboto.css`, "utf8");
const fileContent = require("node:fs").readFileSync(`${__dirname}/../../fonts/roboto.css`, "utf8");
const regex = /\burl\(['"]([^'"]+)['"]\)/g;
let match = regex.exec(fileContent);
while (match !== null) {

View File

@@ -1,4 +1,4 @@
const path = require("path");
const path = require("node:path");
const auth = require("express-basic-auth");
const express = require("express");

View File

@@ -99,6 +99,37 @@ describe("Calendar module", () => {
});
});
//Will contain everyday an fullDayEvent that starts today and ends tomorrow, and one starting tomorrow and ending the day after tomorrow
describe("FullDayEvent over several days should show how many days are left from the from the starting date on", () => {
beforeAll(async () => {
await helpers.startApplication("tests/configs/modules/calendar/long-fullday-event.js");
await helpers.getDocument();
});
it("should contain text 'Ends in' with the left days", async () => {
await expect(testTextContain(".calendar .today .time", "Ends in")).resolves.toBe(true);
await expect(testTextContain(".calendar .yesterday .time", "Today")).resolves.toBe(true);
await expect(testTextContain(".calendar .tomorrow .time", "Tomorrow")).resolves.toBe(true);
});
it("should contain in total three events", async () => {
await expect(testElementLength(".calendar .event", 3)).resolves.toBe(true);
});
});
describe("FullDayEvent Single day, should show Today", () => {
beforeAll(async () => {
await helpers.startApplication("tests/configs/modules/calendar/single-fullday-event.js");
await helpers.getDocument();
});
it("should contain text 'Today'", async () => {
await expect(testTextContain(".calendar .time", "Today")).resolves.toBe(true);
});
it("should contain in total two events", async () => {
await expect(testElementLength(".calendar .event", 2)).resolves.toBe(true);
});
});
process.setMaxListeners(0);
for (let i = -12; i < 12; i++) {
describe("Recurring event per timezone", () => {

View File

@@ -19,11 +19,15 @@ describe("Weather module", () => {
});
it("should render temperature with icon", async () => {
await expect(weatherFunc.getText(".weather .large.light span.bright", "1.5°")).resolves.toBe(true);
await expect(weatherFunc.getText(".weather .large span.light.bright", "1.5°")).resolves.toBe(true);
});
it("should render feels like temperature", async () => {
await expect(weatherFunc.getText(".weather .normal.medium.feelslike span.dimmed", "Feels like -5.6°")).resolves.toBe(true);
// Template contains &nbsp; which renders as \xa0
await expect(weatherFunc.getText(".weather .normal.medium.feelslike span.dimmed", "93.7\xa0 Feels like -5.6°")).resolves.toBe(true);
});
it("should render humidity next to feels-like", async () => {
await expect(weatherFunc.getText(".weather .normal.medium.feelslike span.dimmed .humidity", "93.7")).resolves.toBe(true);
});
});
});
@@ -53,12 +57,12 @@ describe("Weather module", () => {
expect(elem.outerHTML).toContain("transform:rotate(250deg)");
});
it("should render humidity", async () => {
await expect(weatherFunc.getText(".weather .normal.medium span:nth-child(3)", "93.7")).resolves.toBe(true);
it("should render humidity next to wind", async () => {
await expect(weatherFunc.getText(".weather .normal.medium .humidity", "93.7")).resolves.toBe(true);
});
it("should render degreeLabel for temp", async () => {
await expect(weatherFunc.getText(".weather .large.light span.bright", "1°C")).resolves.toBe(true);
await expect(weatherFunc.getText(".weather .large span.bright.light", "1°C")).resolves.toBe(true);
});
it("should render degreeLabel for feels like", async () => {
@@ -76,7 +80,7 @@ describe("Weather module", () => {
});
it("should render temperatures in fahrenheit", async () => {
await expect(weatherFunc.getText(".weather .large.light span.bright", "34,7°")).resolves.toBe(true);
await expect(weatherFunc.getText(".weather .large span.bright.light", "34,7°")).resolves.toBe(true);
});
it("should render 'feels like' in fahrenheit", async () => {

View File

@@ -6,7 +6,7 @@ describe("App environment", () => {
let serverProcess;
beforeAll(async () => {
process.env.MM_CONFIG_FILE = "tests/configs/default.js";
serverProcess = await require("child_process").spawn("npm", ["run", "server"], { env: process.env, detached: true });
serverProcess = await require("node:child_process").spawn("npm", ["run", "server"], { env: process.env, detached: true });
// we have to wait until the server is startet
await delay(2000);
});

View File

@@ -1,4 +1,4 @@
const fs = require("fs");
const fs = require("node:fs");
const helpers = require("./helpers/global-setup");
describe("templated config with port variable", () => {

View File

@@ -1,5 +1,5 @@
const fs = require("fs");
const path = require("path");
const fs = require("node:fs");
const path = require("node:path");
const helmet = require("helmet");
const { JSDOM } = require("jsdom");
const express = require("express");

View File

@@ -1,4 +1,4 @@
const events = require("events");
const events = require("node:events");
const helpers = require("./helpers/global-setup");
describe("Electron app environment", () => {

View File

@@ -3,11 +3,11 @@
// https://www.anycodings.com/1questions/958135/can-i-set-the-date-for-playwright-browser
const { _electron: electron } = require("playwright");
exports.startApplication = async (configFilename, systemDate = null, electronParams = ["js/electron.js"]) => {
exports.startApplication = async (configFilename, systemDate = null, electronParams = ["js/electron.js"], timezone = "GMT") => {
global.electronApp = null;
global.page = null;
process.env.MM_CONFIG_FILE = configFilename;
process.env.TZ = "GMT";
process.env.TZ = timezone;
global.electronApp = await electron.launch({ args: electronParams });
await global.electronApp.firstWindow();
@@ -20,7 +20,7 @@ exports.startApplication = async (configFilename, systemDate = null, electronPar
if (systemDate) {
await global.page.evaluate((systemDate) => {
Date.now = () => {
return new Date(systemDate);
return new Date(systemDate).valueOf();
};
}, systemDate);
}

View File

@@ -44,17 +44,112 @@ describe("Calendar module", () => {
});
});
describe("Exdate check", () => {
it("should show the recurring event 51 times (excluded once) in a 364-day (inclusive) period", async () => {
// test must run on a Thursday
await helpers.startApplication("tests/configs/modules/calendar/exdate.js", "14 Dec 2023 12:30:00 GMT");
/****************************/
// RRULE TESTS:
// Add any tests that check rrule functionality here.
describe("rrule", () => {
it("Issue #3393 recurrence dates past rrule until date", async () => {
await helpers.startApplication("tests/configs/modules/calendar/rrule_until.js", "07 Mar 2024 10:38:00 GMT-07:00", ["js/electron.js"], "America/Los_Angeles");
expect(global.page).not.toBeNull();
const loc = await global.page.locator(".calendar .event");
const elem = loc.first();
await elem.waitFor();
expect(elem).not.toBeNull();
const cnt = await loc.count();
expect(cnt).toBe(51);
expect(cnt).toBe(1);
});
});
/****************************/
// LOS ANGELES TESTS:
// In 2023, DST (GMT-7) was until 5 Nov, after which is standard (STD) (GMT-8) time.
// Test takes place on Thu 19 Oct, recurring event on a Wednesday. maximumNumberOfDays=28, so there should be
// 4 events (25 Oct, 1 Nov, (switch to STD), 8 Nov, Nov 15), but 1 Nov and 8 Nov are excluded.
// There are three separate tests:
// * before midnight GMT (3pm local time)
// * at midnight GMT in STD time (4pm local time)
// * at midnight GMT in DST time (5pm local time)
describe("Exdate: LA crossover DST before midnight GMT", () => {
it("LA crossover DST before midnight GMT should have 2 events", async () => {
await helpers.startApplication("tests/configs/modules/calendar/exdate_la_before_midnight.js", "19 Oct 2023 12:30:00 GMT-07:00", ["js/electron.js"], "America/Los_Angeles");
expect(global.page).not.toBeNull();
const loc = await global.page.locator(".calendar .event");
const elem = loc.first();
await elem.waitFor();
expect(elem).not.toBeNull();
const cnt = await loc.count();
expect(cnt).toBe(2);
});
});
describe("Exdate: LA crossover DST at midnight GMT local STD", () => {
it("LA crossover DST before midnight GMT should have 2 events", async () => {
await helpers.startApplication("tests/configs/modules/calendar/exdate_la_at_midnight_std.js", "19 Oct 2023 12:30:00 GMT-07:00", ["js/electron.js"], "America/Los_Angeles");
expect(global.page).not.toBeNull();
const loc = await global.page.locator(".calendar .event");
const elem = loc.first();
await elem.waitFor();
expect(elem).not.toBeNull();
const cnt = await loc.count();
expect(cnt).toBe(2);
});
});
describe("Exdate: LA crossover DST at midnight GMT local DST", () => {
it("LA crossover DST before midnight GMT should have 2 events", async () => {
await helpers.startApplication("tests/configs/modules/calendar/exdate_la_at_midnight_dst.js", "19 Oct 2023 12:30:00 GMT-07:00", ["js/electron.js"], "America/Los_Angeles");
expect(global.page).not.toBeNull();
const loc = await global.page.locator(".calendar .event");
const elem = loc.first();
await elem.waitFor();
expect(elem).not.toBeNull();
const cnt = await loc.count();
expect(cnt).toBe(2);
});
});
/****************************/
// SYDNEY TESTS:
// In 2023, standard time (STD) (GMT+10) was until 1 Oct, after which is DST (GMT+11).
// Test takes place on Thu 14 Sep, recurring event on a Wednesday. maximumNumberOfDays=28, so there should be
// 4 events (20 Sep, 27 Sep, (switch to DST), 4 Oct, 11 Oct), but 27 Sep and 4 Oct are excluded.
// There are three separate tests:
// * before midnight GMT (9am local time)
// * at midnight GMT in STD time (10am local time)
// * at midnight GMT in DST time (11am local time)
describe("Exdate: SYD crossover DST before midnight GMT", () => {
it("LA crossover DST before midnight GMT should have 2 events", async () => {
await helpers.startApplication("tests/configs/modules/calendar/exdate_syd_before_midnight.js", "14 Sep 2023 12:30:00 GMT+10:00", ["js/electron.js"], "Australia/Sydney");
expect(global.page).not.toBeNull();
const loc = await global.page.locator(".calendar .event");
const elem = loc.first();
await elem.waitFor();
expect(elem).not.toBeNull();
const cnt = await loc.count();
expect(cnt).toBe(2);
});
});
describe("Exdate: SYD crossover DST at midnight GMT local STD", () => {
it("LA crossover DST before midnight GMT should have 2 events", async () => {
await helpers.startApplication("tests/configs/modules/calendar/exdate_syd_at_midnight_std.js", "14 Sep 2023 12:30:00 GMT+10:00", ["js/electron.js"], "Australia/Sydney");
expect(global.page).not.toBeNull();
const loc = await global.page.locator(".calendar .event");
const elem = loc.first();
await elem.waitFor();
expect(elem).not.toBeNull();
const cnt = await loc.count();
expect(cnt).toBe(2);
});
});
describe("Exdate: SYD crossover DST at midnight GMT local DST", () => {
it("SYD crossover DST at midnight GMT local DST should have 2 events", async () => {
await helpers.startApplication("tests/configs/modules/calendar/exdate_syd_at_midnight_dst.js", "14 Sep 2023 12:30:00 GMT+10:00", ["js/electron.js"], "Australia/Sydney");
expect(global.page).not.toBeNull();
const loc = await global.page.locator(".calendar .event");
const elem = loc.first();
await elem.waitFor();
expect(elem).not.toBeNull();
const cnt = await loc.count();
expect(cnt).toBe(2);
});
});
});

View File

@@ -1,34 +0,0 @@
BEGIN:VEVENT
DTSTART;TZID=UTC:20231025T181000
DTEND;TZID=UTC:20231025T195000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=UTC:20231101T181000
EXDATE;TZID=UTC:20241030T181000
EXDATE;TZID=UTC:20251029T181000
EXDATE;TZID=UTC:20261028T181000
EXDATE;TZID=UTC:20271027T181000
EXDATE;TZID=UTC:20281025T181000
EXDATE;TZID=UTC:20291024T181000
EXDATE;TZID=UTC:20301023T181000
EXDATE;TZID=UTC:20311022T181000
EXDATE;TZID=UTC:20321020T181000
EXDATE;TZID=UTC:20331019T181000
EXDATE;TZID=UTC:20341018T181000
EXDATE;TZID=UTC:20351017T181000
EXDATE;TZID=UTC:20361015T181000
EXDATE;TZID=UTC:20371014T181000
EXDATE;TZID=UTC:20381013T181000
EXDATE;TZID=UTC:20391012T181000
EXDATE;TZID=UTC:20401010T181000
EXDATE;TZID=UTC:20411009T181000
EXDATE;TZID=UTC:20421008T181000
EXDATE;TZID=UTC:20431007T181000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -0,0 +1,33 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ical.marudot.com//iCal Event Maker
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
LAST-MODIFIED:20231222T233358Z
TZURL:https://www.tzurl.org/zoneinfo-outlook/Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20240306T225415Z
UID:1709765647426-75770@ical.marudot.com
DTSTART;VALUE=DATE:20240306
RRULE:FREQ=DAILY
DTEND;VALUE=DATE:20240307
SUMMARY:daily full days
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,33 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ical.marudot.com//iCal Event Maker
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
LAST-MODIFIED:20231222T233358Z
TZURL:https://www.tzurl.org/zoneinfo-outlook/Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20240306T222634Z
UID:1709763965312-82782@ical.marudot.com
DTSTART;VALUE=DATE:20240301
RRULE:FREQ=DAILY
DTEND;VALUE=DATE:20240303
SUMMARY:2 day events
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,15 @@
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20231025T170000
DTEND;TZID=America/Los_Angeles:20231025T180000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=America/Los_Angeles:20231101T170000
EXDATE;TZID=America/Los_Angeles:20231108T170000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -0,0 +1,15 @@
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20231025T160000
DTEND;TZID=America/Los_Angeles:20231025T170000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=America/Los_Angeles:20231101T160000
EXDATE;TZID=America/Los_Angeles:20231108T160000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -0,0 +1,15 @@
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20231025T150000
DTEND;TZID=America/Los_Angeles:20231025T160000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=America/Los_Angeles:20231101T150000
EXDATE;TZID=America/Los_Angeles:20231108T150000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -0,0 +1,15 @@
BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20230920T110000
DTEND;TZID=Australia/Sydney:20230920T111000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=Australia/Sydney:20230927T110000
EXDATE;TZID=Australia/Sydney:20231004T110000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -0,0 +1,15 @@
BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20230920T100000
DTEND;TZID=Australia/Sydney:20230920T110000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=Australia/Sydney:20230927T100000
EXDATE;TZID=Australia/Sydney:20231004T100000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -0,0 +1,15 @@
BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20230920T090000
DTEND;TZID=Australia/Sydney:20230920T100000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=Australia/Sydney:20230927T090000
EXDATE;TZID=Australia/Sydney:20231004T090000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -0,0 +1,24 @@
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20240229T160000
DTEND;TZID=America/Los_Angeles:20240229T190000
RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20240307T075959Z;BYDAY=TH
DTSTAMP:20240307T180618Z
CREATED:20231231T000501Z
LAST-MODIFIED:20231231T005623Z
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:My event
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=America/Los_Angeles:20240307T160000
DTEND;TZID=America/Los_Angeles:20240307T190000
RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20240316T065959Z;BYDAY=TH
DTSTAMP:20240307T180618Z
CREATED:20231231T000501Z
LAST-MODIFIED:20231231T005623Z
SEQUENCE:3
STATUS:CONFIRMED
SUMMARY:My event
TRANSP:OPAQUE
END:VEVENT

View File

@@ -1,4 +1,4 @@
const path = require("path");
const path = require("node:path");
const { JSDOM } = require("jsdom");
describe("File js/class", () => {

View File

@@ -1,4 +1,4 @@
const path = require("path");
const path = require("node:path");
const helmet = require("helmet");
const { JSDOM } = require("jsdom");
const express = require("express");

View File

@@ -1,38 +1,7 @@
const colors = require("colors/safe");
const Utils = require("../../../js/utils");
describe("Utils", () => {
describe("colors", () => {
const colorsEnabled = colors.enabled;
afterEach(() => {
colors.enabled = colorsEnabled;
});
it("should have info, warn and error properties", () => {
expect(Utils.colors).toHaveProperty("info");
expect(Utils.colors).toHaveProperty("warn");
expect(Utils.colors).toHaveProperty("error");
});
it("properties should be functions", () => {
expect(typeof Utils.colors.info).toBe("function");
expect(typeof Utils.colors.warn).toBe("function");
expect(typeof Utils.colors.error).toBe("function");
});
it("should print colored message in supported consoles", () => {
colors.enabled = true;
expect(Utils.colors.info("some informations")).toBe("\u001b[34msome informations\u001b[39m");
expect(Utils.colors.warn("a warning")).toBe("\u001b[33ma warning\u001b[39m");
expect(Utils.colors.error("ERROR!")).toBe("\u001b[31mERROR!\u001b[39m");
});
it("should print message in unsupported consoles", () => {
colors.enabled = false;
expect(Utils.colors.info("some informations")).toBe("some informations");
expect(Utils.colors.warn("a warning")).toBe("a warning");
expect(Utils.colors.error("ERROR!")).toBe("ERROR!");
});
it("should output system information", async () => {
await expect(Utils.logSystemInformation()).resolves.toContain("platform: linux");
});
});

View File

@@ -1,4 +1,4 @@
const path = require("path");
const path = require("node:path");
const { JSDOM } = require("jsdom");
describe("Test function cmpVersions in js/module.js", () => {

View File

@@ -1,9 +1,9 @@
jest.mock("util", () => ({
jest.mock("node:util", () => ({
...jest.requireActual("util"),
promisify: jest.fn()
}));
jest.mock("fs", () => ({
jest.mock("node:fs", () => ({
...jest.requireActual("fs"),
statSync: jest.fn()
}));
@@ -29,7 +29,7 @@ describe("Updatenotification", () => {
let gitTagListOut;
beforeAll(async () => {
const { promisify } = require("util");
const { promisify } = require("node:util");
promisify.mockReturnValue(execMock);
const GitHelper = require("../../../modules/default/updatenotification/git_helper");
@@ -75,10 +75,10 @@ describe("Updatenotification", () => {
const moduleName = "MagicMirror";
beforeEach(async () => {
gitRemoteOut = "origin\tgit@github.com:MichMich/MagicMirror.git (fetch)\norigin\tgit@github.com:MichMich/MagicMirror.git (push)\n";
gitRemoteOut = "origin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (fetch)\norigin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (push)\n";
gitRevParseOut = "332e429a41f1a2339afd4f0ae96dd125da6beada";
gitStatusOut = "## develop...origin/develop\n M tests/unit/functions/updatenotification_spec.js\n";
gitFetchErr = "From github.com:MichMich/MagicMirror\n60e0377..332e429 develop -> origin/develop\n";
gitFetchErr = "From github.com:MagicMirrorOrg/MagicMirror\n60e0377..332e429 develop -> origin/develop\n";
gitRevListCountOut = "5";
await gitHelper.add(moduleName);
@@ -114,10 +114,10 @@ describe("Updatenotification", () => {
const moduleName = "MagicMirror";
beforeEach(async () => {
gitRemoteOut = "origin\tgit@github.com:MichMich/MagicMirror.git (fetch)\norigin\tgit@github.com:MichMich/MagicMirror.git (push)\n";
gitRemoteOut = "origin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (fetch)\norigin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (push)\n";
gitRevParseOut = "332e429a41f1a2339afd4f0ae96dd125da6beada";
gitStatusOut = "## master...origin/master\n M tests/unit/functions/updatenotification_spec.js\n";
gitFetchErr = "From github.com:MichMich/MagicMirror\n60e0377..332e429 master -> origin/master\n";
gitFetchErr = "From github.com:MagicMirrorOrg/MagicMirror\n60e0377..332e429 master -> origin/master\n";
gitRevListCountOut = "5";
await gitHelper.add(moduleName);
@@ -153,10 +153,10 @@ describe("Updatenotification", () => {
const moduleName = "MagicMirror";
beforeEach(async () => {
gitRemoteOut = "origin\tgit@github.com:MichMich/MagicMirror.git (fetch)\norigin\tgit@github.com:MichMich/MagicMirror.git (push)\n";
gitRemoteOut = "origin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (fetch)\norigin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (push)\n";
gitRevParseOut = "332e429a41f1a2339afd4f0ae96dd125da6beada";
gitStatusOut = "## master...origin/master\n M tests/unit/functions/updatenotification_spec.js\n";
gitFetchErr = "From github.com:MichMich/MagicMirror\n60e0377..332e429 master -> origin/master\n";
gitFetchErr = "From github.com:MagicMirrorOrg/MagicMirror\n60e0377..332e429 master -> origin/master\n";
gitRevListCountOut = "5";
gitTagListOut = "332e429a41f1a2339afd4f0ae96dd125da6beada...tag...\n";
gitRevListOut = "332e429a41f1a2339afd4f0ae96dd125da6beada\n";
@@ -194,10 +194,10 @@ describe("Updatenotification", () => {
const moduleName = "MagicMirror";
beforeEach(async () => {
gitRemoteOut = "origin\tgit@github.com:MichMich/MagicMirror.git (fetch)\norigin\tgit@github.com:MichMich/MagicMirror.git (push)\n";
gitRemoteOut = "origin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (fetch)\norigin\tgit@github.com:MagicMirrorOrg/MagicMirror.git (push)\n";
gitRevParseOut = "332e429a41f1a2339afd4f0ae96dd125da6beada";
gitStatusOut = "## master...origin/master\n M tests/unit/functions/updatenotification_spec.js\n";
gitFetchErr = "From github.com:MichMich/MagicMirror\n60e0377..332e429 master -> origin/master\n";
gitFetchErr = "From github.com:MagicMirrorOrg/MagicMirror\n60e0377..332e429 master -> origin/master\n";
gitRevListCountOut = "5";
gitTagListOut = "xxxe429a41f1a2339afd4f0ae96dd125da6beada...tag...\n";
gitRevListOut = "332e429a41f1a2339afd4f0ae96dd125da6beada\n";

View File

@@ -1,5 +1,5 @@
const fs = require("fs");
const path = require("path");
const fs = require("node:fs");
const path = require("node:path");
const root_path = path.join(__dirname, "../../..");

View File

@@ -1,5 +1,5 @@
const fs = require("fs");
const path = require("path");
const fs = require("node:fs");
const path = require("node:path");
const root_path = path.join(__dirname, "../../..");
const version = require(`${__dirname}/../../../package.json`).version;

View File

@@ -1,8 +1,7 @@
const fs = require("fs");
const path = require("path");
const util = require("util");
const exec = util.promisify(require("child_process").exec);
const _ = require("lodash");
const fs = require("node:fs");
const path = require("node:path");
const util = require("node:util");
const exec = util.promisify(require("node:child_process").exec);
/**
* @param {string} type what data to read, can be "current" "forecast" or "hourly
@@ -25,7 +24,9 @@ const readMockData = (type, extendedData = {}) => {
break;
}
return JSON.stringify(_.merge({}, JSON.parse(fs.readFileSync(path.resolve(`${__dirname}/../mocks/${fileName}`)).toString()), extendedData));
const fileData = JSON.parse(fs.readFileSync(path.resolve(`${__dirname}/../mocks/${fileName}`)).toString());
const mergedData = JSON.stringify({ ...{}, ...fileData, ...extendedData });
return mergedData;
};
const injectMockData = (configFileName, extendedData = {}) => {