Skip to content

Raise the RequireJS and Mocha timeouts of the UI unit tests - #1148

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/karma-requirejs-timeout
Sep 29, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/karma-requirejs-timeout

Conversation

@vharseko

Copy link
Copy Markdown
Member

Problem

build-maven (windows-latest, 11) on master (run 36570003414) failed in openam-ui-ria on the very first karma test:

org/forgerock/openam/ui/user/login/RESTLoginHelper "before all" hook in "org/forgerock/openam/ui/user/login/RESTLoginHelper" FAILED
	Error: Uncaught Error: Load timeout for modules: org/forgerock/commons/ui/common/main/EventManager,config/AppConfiguration,
	org/forgerock/commons/ui/common/main/ErrorsHandler,org/forgerock/commons/ui/common/main/i18nManager,store/index,
	org/forgerock/commons/ui/common/util/CookieHelper,org/forgerock/commons/ui/common/main/AbstractDelegate,moment
TOTAL: 1 FAILED, 146 SUCCESS

The error came after 7.049 s, which is RequireJS's default waitSeconds of 7: test-main.js does not set it. The other 146 tests loaded the same modules without trouble, and the triggering commit (#1147) only bumps GitHub Actions versions. So this is a slow cold start on the runner, not a broken module.

The hook's Mocha timeout (6 s, karma.conf.js) should have fired before the 7 s RequireJS limit, but it had not. That means the runner held back the browser's timers, so raising waitSeconds alone would only turn the same stall into a Mocha timeout.

Change

  • src/test/js/test-main.js: waitSeconds: 60. Squire copies the default context's config, this value included, into every context it creates, so it covers the before hooks too.
  • karma.conf.js: Mocha timeout 6000 → 30000. It stays below waitSeconds, so a slow load inside a test is reported by Mocha, and the RequireJS limit only bounds the initial load of the test files. A missing module (404) still fails at once through RequireJS's script error, not through the timeout.

Testing

mvn -pl openam-ui/openam-ui-ria verify locally: TOTAL: 151 SUCCESS, BUILD SUCCESS.

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.
@vharseko vharseko added bug tests Test suite: coverage, fixtures, or test infrastructure javascript Pull requests that update Javascript code ui XUI / admin console / end-user UI windows labels Sep 29, 2026

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vharseko
vharseko merged commit 834d4a7 into OpenIdentityPlatform:master Sep 29, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug javascript Pull requests that update Javascript code tests Test suite: coverage, fixtures, or test infrastructure ui XUI / admin console / end-user UI windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants