Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/envcanada.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EnvCanadaProvider {
this.currentHour = null; // Track current hour for URL updates
}

async initialize () {
initialize () {
this.#validateConfig();
this.#initializeFetcher();
}
Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/openweathermap.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OpenWeatherMapProvider {
this.locationName = null;
}

async initialize () {
initialize () {
// Validate callbacks exist
if (typeof this.onErrorCallback !== "function") {
throw new Error("setCallbacks() must be called before initialize()");
Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/pirateweather.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PirateweatherProvider {
this.onErrorCallback = onErrorCallback;
}

async initialize () {
initialize () {
if (!this.config.apiKey) {
Log.error("[pirateweather] No API key configured");
if (this.onErrorCallback) {
Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/smhi.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SMHIProvider {
this.onErrorCallback = null;
}

async initialize () {
initialize () {
try {
// SMHI requires max 6 decimal places
validateCoordinates(this.config, 6);
Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/ukmetofficedatahub.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class UkMetOfficeDataHubProvider {
this.onErrorCallback = onErrorCallback;
}

async initialize () {
initialize () {
if (!this.config.apiKey || this.config.apiKey === "YOUR_API_KEY_HERE") {
Log.error("[ukmetofficedatahub] No API key configured");
if (this.onErrorCallback) {
Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/weatherapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WeatherAPIProvider {
this.onErrorCallback = null;
}

async initialize () {
initialize () {
this.#validateConfig();
this.#initializeFetcher();
}
Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/weatherbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WeatherbitProvider {
this.onErrorCallback = onErrorCallback;
}

async initialize () {
initialize () {
if (!this.config.apiKey || this.config.apiKey === "YOUR_API_KEY_HERE") {
Log.error("[weatherbit] No API key configured");
if (this.onErrorCallback) {
Expand Down
2 changes: 1 addition & 1 deletion defaultmodules/weather/providers/weatherflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class WeatherFlowProvider {
/**
* Initialize the provider
*/
async initialize () {
initialize () {
if (!this.config.token || this.config.token === "YOUR_API_TOKEN_HERE") {
Log.error("[weatherflow] No API token configured. Get one at https://tempestwx.com/");
if (this.onErrorCallback) {
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default defineConfig([
"object-shorthand": ["error", "methods"],
"one-var": "off",
"prefer-template": "error",
"require-await": "error",
"sort-keys": "off"
}
},
Expand Down
6 changes: 3 additions & 3 deletions js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const Loader = (function () {
* @param {string} fileName Path of the file we want to load.
* @returns {Promise} resolved when the file is loaded
*/
const loadFile = async function (fileName) {
const loadFile = function (fileName) {
const extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1);
let script, stylesheet;

Expand Down Expand Up @@ -267,10 +267,10 @@ const Loader = (function () {
* @param {Module} module The module that calls the loadFile function.
* @returns {Promise} resolved when the file is loaded
*/
async loadFileForModule (fileName, module) {
loadFileForModule (fileName, module) {
if (loadedFiles.indexOf(fileName.toLowerCase()) !== -1) {
Log.log(`File already loaded: ${fileName}`);
return;
return Promise.resolve();
}

if (fileName.indexOf("http://") === 0 || fileName.indexOf("https://") === 0 || fileName.indexOf("/") !== -1) {
Expand Down
2 changes: 1 addition & 1 deletion js/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Module = Class.extend({
/**
* Called when the module is started.
*/
async start () {
start () {
Log.info(`Starting module: ${this.name}`);
},

Expand Down
4 changes: 2 additions & 2 deletions serveronly/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ function notifyClientsToReload () {
* Restart the server process
* @param {string} reason The reason for the restart
*/
async function restartServer (reason) {
function restartServer (reason) {
if (restartTimer) clearTimeout(restartTimer);

restartTimer = setTimeout(async () => {
restartTimer = setTimeout(() => {
Log.info(reason);

if (child) {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/clientonly_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe("Clientonly parameter handling", () => {
});

describe("Display environment check", () => {
it("should fail without DISPLAY or WAYLAND_DISPLAY when connecting to valid server", async () => {
it("should fail without DISPLAY or WAYLAND_DISPLAY when connecting to valid server", () => {
// This test needs a running server to get past the connection phase
// Without DISPLAY, it should fail with display error
// For now, we just verify it fails (connection error comes first without server)
Expand All @@ -159,7 +159,7 @@ describe("Clientonly with running server", () => {
await delay(2000);
});

afterAll(async () => {
afterAll(() => {
if (serverProcess && serverProcess.pid) {
try {
process.kill(-serverProcess.pid);
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/config_variables_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ describe("config with variables and secrets", () => {
await helpers.stopApplication();
});

it("config.language should be \"de\"", async () => {
it("config.language should be \"de\"", () => {
expect(config.language).toBe("de");
});

it("config.loglevel should be [\"ERROR\", \"LOG\", \"WARN\", \"INFO\"]", async () => {
it("config.loglevel should be [\"ERROR\", \"LOG\", \"WARN\", \"INFO\"]", () => {
expect(config.logLevel).toStrictEqual(["ERROR", "LOG", "WARN", "INFO"]);
});

it("config.ipWhitelist should be [\"::ffff:127.0.0.1\", \"::1\", \"127.0.0.1\"]", async () => {
it("config.ipWhitelist should be [\"::ffff:127.0.0.1\", \"::1\", \"127.0.0.1\"]", () => {
expect(config.ipWhitelist).toStrictEqual(["::ffff:127.0.0.1", "::1", "127.0.0.1"]);
});

it("config.timeFormat should be 12", async () => {
it("config.timeFormat should be 12", () => {
expect(config.timeFormat).toBe(12); // default is 24
});

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/modules/newsfeed_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("node:fs");
const { expect } = require("playwright/test");
const helpers = require("../helpers/global-setup");

const runTests = async () => {
const runTests = () => {
let page;

describe("Default configuration", () => {
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/classes/translator_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe("Translator", () => {
Translator.coreTranslationsFallback = coreTranslationsFallback;
};

it("should return custom module translation", async () => {
it("should return custom module translation", () => {
const { Translator } = createTranslationTestEnvironment();
setTranslations(Translator);

Expand All @@ -104,7 +104,7 @@ describe("Translator", () => {
expect(translation).toBe("Hallo fewieden");
});

it("should return core translation", async () => {
it("should return core translation", () => {
const { Translator } = createTranslationTestEnvironment();
setTranslations(Translator);
let translation = Translator.translate({ name: "MMM-Module" }, "FOO");
Expand All @@ -113,28 +113,28 @@ describe("Translator", () => {
expect(translation).toBe("Bar Lorem Ipsum");
});

it("should return custom module translation fallback", async () => {
it("should return custom module translation fallback", () => {
const { Translator } = createTranslationTestEnvironment();
setTranslations(Translator);
const translation = Translator.translate({ name: "MMM-Module" }, "A key");
expect(translation).toBe("A translation");
});

it("should return core translation fallback", async () => {
it("should return core translation fallback", () => {
const { Translator } = createTranslationTestEnvironment();
setTranslations(Translator);
const translation = Translator.translate({ name: "MMM-Module" }, "Fallback");
expect(translation).toBe("core fallback");
});

it("should return translation with placeholder for missing variables", async () => {
it("should return translation with placeholder for missing variables", () => {
const { Translator } = createTranslationTestEnvironment();
setTranslations(Translator);
const translation = Translator.translate({ name: "MMM-Module" }, "Hello {username}");
expect(translation).toBe("Hallo {username}");
});

it("should return key if no translation was found", async () => {
it("should return key if no translation was found", () => {
const { Translator } = createTranslationTestEnvironment();
setTranslations(Translator);
const translation = Translator.translate({ name: "MMM-Module" }, "MISSING");
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/functions/server_functions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe("server_functions tests", () => {
expect(corsResponse.set.mock.calls[2][1]).toBe("value2");
});

it("Gets User-Agent from configuration", async () => {
it("Gets User-Agent from configuration", () => {
const previousConfig = global.config;
global.config = {};
let userAgent;
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/functions/updatenotification_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ describe("Updatenotification", () => {
describe("custom module", () => {
const moduleName = "MMM-Fuel";

beforeEach(async () => {
beforeEach(() => {
gitRemoteOut = `origin\thttps://github.com/fewieden/${moduleName}.git (fetch)\norigin\thttps://github.com/fewieden/${moduleName}.git (push)\n`;
gitRevParseOut = "9d8310163da94441073a93cead711ba43e8888d0";
gitStatusOut = "## master...origin/master";
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/global-setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = async () => {
module.exports = () => {
process.env.TZ = "UTC";
};
2 changes: 1 addition & 1 deletion tests/unit/modules/default/utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Default modules utils tests", () => {
describe("formatTime", () => {
const time = new Date();

beforeEach(async () => {
beforeEach(() => {
time.setHours(13, 13);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ describe("EnvCanadaProvider", () => {
expect(provider.config.type).toBe("current");
});

it("should throw error if siteCode or provCode missing", async () => {
it("should throw error if siteCode or provCode missing", () => {
const provider = new EnvCanadaProvider({ siteCode: "", provCode: "" });
provider.setCallbacks(vi.fn(), vi.fn());
await expect(provider.initialize()).rejects.toThrow("siteCode and provCode are required");
expect(() => provider.initialize()).toThrow("siteCode and provCode are required");
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ describe("OpenWeatherMapProvider", () => {
expect(provider.fetcher).toBeNull();
});

it("should throw if setCallbacks not called before initialize", async () => {
it("should throw if setCallbacks not called before initialize", () => {
const provider = new OpenWeatherMapProvider({ apiKey: "test" });
await expect(provider.initialize()).rejects.toThrow("setCallbacks");
expect(() => provider.initialize()).toThrow("setCallbacks");
});
});

Expand Down