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:
Karsten Hassel 2025-06-21 13:40:10 +02:00 committed by GitHub
parent 2809ed1750
commit d2d4d7b37f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 968 additions and 720 deletions

View File

@ -51,7 +51,7 @@ planned for 2025-07-01
### Updated ### Updated
- [core] Update dependencies including electron to v36 (#3774, #3788, #3811, #3804) - [core] Update dependencies including electron to v36 (#3774, #3788, #3811, #3804, #3815)
- [core] Update package type to `commonjs` - [core] Update package type to `commonjs`
- [logger] Review factory code part: use `switch/case` instead of `if/else if` (#3812) - [logger] Review factory code part: use `switch/case` instead of `if/else if` (#3812)

1662
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -97,7 +97,7 @@
"eslint-plugin-package-json": "^0.40.1", "eslint-plugin-package-json": "^0.40.1",
"express-basic-auth": "^1.2.1", "express-basic-auth": "^1.2.1",
"husky": "^9.1.7", "husky": "^9.1.7",
"jest": "^29.7.0", "jest": "^30.0.2",
"jsdom": "^26.1.0", "jsdom": "^26.1.0",
"lint-staged": "^16.1.2", "lint-staged": "^16.1.2",
"markdownlint-cli2": "^0.18.1", "markdownlint-cli2": "^0.18.1",

View File

@ -33,7 +33,14 @@ exports.startApplication = async (configFilename, exec) => {
return global.app.start(); 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) { if (!global.app) {
return Promise.resolve(); return Promise.resolve();
} }

View File

@ -27,3 +27,5 @@ global.console = {
info: jest.fn(), info: jest.fn(),
debug: console.debug debug: console.debug
}; };
process.setMaxListeners(0);

View File

@ -119,7 +119,6 @@ describe("Calendar module", () => {
}); });
}); });
process.setMaxListeners(0);
for (let i = -12; i < 12; i++) { for (let i = -12; i < 12; i++) {
describe("Recurring event per timezone", () => { describe("Recurring event per timezone", () => {
beforeAll(async () => { beforeAll(async () => {

View File

@ -40,9 +40,9 @@ describe("Clock module", () => {
}); });
it("check for discreet elements of clock", async () => { 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(); await expect(elemClock).not.toBeNull();
elemClock = helpers.waitForElement(".clock-minute-digital"); elemClock = await helpers.waitForElement(".clock-minute-digital");
await expect(elemClock).not.toBeNull(); await expect(elemClock).not.toBeNull();
}); });
}); });
@ -165,7 +165,7 @@ describe("Clock module", () => {
}); });
it("should show the analog clock face", async () => { 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(); expect(elem).not.toBeNull();
}); });
}); });
@ -177,9 +177,9 @@ describe("Clock module", () => {
}); });
it("should show the analog clock face and the date", async () => { 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(); await expect(elemClock).not.toBeNull();
const elemDate = helpers.waitForElement(".clock .date"); const elemDate = await helpers.waitForElement(".clock .date");
await expect(elemDate).not.toBeNull(); await expect(elemDate).not.toBeNull();
}); });
}); });