diff --git a/CHANGELOG.md b/CHANGELOG.md index eed2625c..9e3ec6d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ Thanks to: @dathbe. - [clock] Add CSS to prevent line breaking of sunset/sunrise time display (#3816) - [core] Enhance system information logging format and include additional env and RAM details (#3839, #3843) - [refactor] Add new file `js/module_functions.js` to move code used in several modules to one place (#3837) -- [refactor] Use global.root_path where possible and add test for config:check (#3883, #3885, #3886) +- [refactor] Use global.root_path where possible and add tests for config:check (#3883, #3885, #3886, #3889) - [tests] refactor: simplify jest config file (#3844) - [tests] refactor: extract constants for weather electron tests (#3845) - [tests] refactor: add `setupDOMEnvironment` helper function to eliminate repetitive JSDOM setup code (#3860) diff --git a/tests/e2e/serveronly_spec.js b/tests/e2e/serveronly_spec.js index 313a4566..be44675d 100644 --- a/tests/e2e/serveronly_spec.js +++ b/tests/e2e/serveronly_spec.js @@ -2,6 +2,12 @@ const delay = (time) => { return new Promise((resolve) => setTimeout(resolve, time)); }; +const runConfigCheck = async () => { + const serverProcess = await require("node:child_process").spawnSync("node", ["--run", "config:check"], { env: process.env }); + expect(serverProcess.stderr.toString()).toBe(""); + return await serverProcess.status; +}; + describe("App environment", () => { let serverProcess; beforeAll(async () => { @@ -28,7 +34,11 @@ describe("App environment", () => { describe("Check config", () => { it("config check should return without errors", async () => { process.env.MM_CONFIG_FILE = "tests/configs/default.js"; - const serverProcess = await require("node:child_process").spawnSync("node", ["--run", "config:check"], { env: process.env }); - expect(serverProcess.stderr.toString()).toBe(""); + await expect(runConfigCheck()).resolves.toBe(0); + }); + + it("config check should fail with non existent config file", async () => { + process.env.MM_CONFIG_FILE = "tests/configs/not_exists.js"; + await expect(runConfigCheck()).resolves.toBe(1); }); });