From 908cc09c19ec06396e6603434a60d461777e6013 Mon Sep 17 00:00:00 2001 From: Valera V Harseko Date: Tue, 29 Sep 2026 16:42:10 +0300 Subject: [PATCH] Raise the RequireJS and Mocha timeouts of the UI unit tests The first karma test on the Windows runner failed with a RequireJS "Load timeout for modules" after 7.049 s: the default waitSeconds of 7 was hit while the "before" hook of RESTLoginHelperTest loaded the module under test through Squire. Its 6 s Mocha timeout had not fired yet, so the runner held back the browser's timers; raising waitSeconds alone would turn the same stall into a Mocha timeout. Set waitSeconds to 60 (Squire copies it into every context it creates) and the Mocha timeout to 30 s, keeping the Mocha limit below the RequireJS one so a slow load inside a test is reported by Mocha. --- openam-ui/openam-ui-ria/karma.conf.js | 20 ++++++++++++++++++- .../openam-ui-ria/src/test/js/test-main.js | 6 +++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/openam-ui/openam-ui-ria/karma.conf.js b/openam-ui/openam-ui-ria/karma.conf.js index 4226257218..04158945cd 100644 --- a/openam-ui/openam-ui-ria/karma.conf.js +++ b/openam-ui/openam-ui-ria/karma.conf.js @@ -1,8 +1,26 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions copyright [year] [name of copyright owner]". + * + * Portions copyright 2026 3A Systems LLC. + */ + module.exports = function (config) { config.set({ client: { mocha: { - timeout : 6000 + // A "before" hook that loads the module under test through Squire can take several seconds + // on a loaded CI runner; keep this below waitSeconds in src/test/js/test-main.js. + timeout : 30000 } }, basePath: ".", diff --git a/openam-ui/openam-ui-ria/src/test/js/test-main.js b/openam-ui/openam-ui-ria/src/test/js/test-main.js index 8c33e5404b..3c259c46bc 100644 --- a/openam-ui/openam-ui-ria/src/test/js/test-main.js +++ b/openam-ui/openam-ui-ria/src/test/js/test-main.js @@ -12,7 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2015-2016 ForgeRock AS. - * Portions copyright 2025 3A Systems LLC. + * Portions copyright 2025-2026 3A Systems LLC. */ (function () { @@ -23,6 +23,10 @@ require.config({ baseUrl: "/base/target/compiled", + // The default of 7 seconds is too short on a loaded CI runner, and Squire copies this value into + // every context it creates. Keep it above the Mocha timeout in karma.conf.js, so a slow load inside a + // test is reported by Mocha and this limit only bounds the initial load of the test files. + waitSeconds: 60, map: { "*": {