IS-5161 Stub window.__CONFIG__ in setupTests for jsdom#160
Draft
aleixsuau wants to merge 1 commit into
Draft
Conversation
bootstrap-configuration.ts throws at import time if window.__CONFIG__ is unset. jsdom doesn't run loader.vm.html, so the import-time check crashed any suite transitively importing the data-access barrel. Inject a minimal stub in setupTests.ts so the test env honors the same "world configured before import" invariant the production loader provides. Drop the now-redundant vi.mock of bootstrap-configuration in HaapiStepper.spec.tsx and read configuration.initialUrl from the real export.
luisgoncalves
approved these changes
May 11, 2026
| tokenEndpoint: 'https://example.test/oauth/token', | ||
| }, | ||
| }; | ||
|
|
Contributor
There was a problem hiding this comment.
Did the need come up because of other test files?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: https://curity.atlassian.net/browse/IS-5161
Summary
bootstrap-configuration.tsthrows at import time ifwindow.__CONFIG__is unset. jsdom doesn't runloader.vm.html, so any suite transitively importing the data-access barrel crashed at module load.setupTests.tsso the test env honors the same "world configured before import" invariant the production loader provides.vi.mock('bootstrap-configuration')inHaapiStepper.spec.tsx; the assertion that referenced itsinitialUrlnow reads from the realconfigurationexport.