mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 21:11:17 +00:00
update jest to v30 (#3815)
e2e: - needed window.close(), otherwise the objects are not destroyed - add missing `await` in clock test - set maxListeners for all tests remaining todo (comes with another PR if I find the problem): - calendar e2e is now the only test which still needs `--forceExit`
This commit is contained in:
@@ -33,7 +33,14 @@ exports.startApplication = async (configFilename, exec) => {
|
||||
return global.app.start();
|
||||
};
|
||||
|
||||
exports.stopApplication = async () => {
|
||||
exports.stopApplication = async (waitTime = 1000) => {
|
||||
if (global.window) {
|
||||
// no closing causes jest errors and memory leaks
|
||||
global.window.close();
|
||||
delete global.window;
|
||||
// give above closing some extra time to finish
|
||||
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
||||
}
|
||||
if (!global.app) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
@@ -27,3 +27,5 @@ global.console = {
|
||||
info: jest.fn(),
|
||||
debug: console.debug
|
||||
};
|
||||
|
||||
process.setMaxListeners(0);
|
||||
|
@@ -119,7 +119,6 @@ describe("Calendar module", () => {
|
||||
});
|
||||
});
|
||||
|
||||
process.setMaxListeners(0);
|
||||
for (let i = -12; i < 12; i++) {
|
||||
describe("Recurring event per timezone", () => {
|
||||
beforeAll(async () => {
|
||||
|
@@ -40,9 +40,9 @@ describe("Clock module", () => {
|
||||
});
|
||||
|
||||
it("check for discreet elements of clock", async () => {
|
||||
let elemClock = helpers.waitForElement(".clock-hour-digital");
|
||||
let elemClock = await helpers.waitForElement(".clock-hour-digital");
|
||||
await expect(elemClock).not.toBeNull();
|
||||
elemClock = helpers.waitForElement(".clock-minute-digital");
|
||||
elemClock = await helpers.waitForElement(".clock-minute-digital");
|
||||
await expect(elemClock).not.toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -165,7 +165,7 @@ describe("Clock module", () => {
|
||||
});
|
||||
|
||||
it("should show the analog clock face", async () => {
|
||||
const elem = helpers.waitForElement(".clock-circle");
|
||||
const elem = await helpers.waitForElement(".clock-circle");
|
||||
expect(elem).not.toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -177,9 +177,9 @@ describe("Clock module", () => {
|
||||
});
|
||||
|
||||
it("should show the analog clock face and the date", async () => {
|
||||
const elemClock = helpers.waitForElement(".clock-circle");
|
||||
const elemClock = await helpers.waitForElement(".clock-circle");
|
||||
await expect(elemClock).not.toBeNull();
|
||||
const elemDate = helpers.waitForElement(".clock .date");
|
||||
const elemDate = await helpers.waitForElement(".clock .date");
|
||||
await expect(elemDate).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user