Skip to content

test(browser): Use blocking scripts in loader integration tests - #25395

Merged
mydea merged 1 commit into
developfrom
fix/loader-tests-deferred-scripts
Oct 15, 2026
Merged

mydea merged 1 commit into
developfrom
fix/loader-tests-deferred-scripts

Conversation

@mydea

@mydea mydea commented Oct 15, 2026

Copy link
Copy Markdown
Member

Loader tests were flaky (e.g. sentryOnLoad callback is called before Sentry.onLoad() timing out waiting for the error event).

HtmlWebpackPlugin defaults to defer for the test's init/subject scripts. With a non-lazy loader, the CDN bundle can load and replace the window.Sentry stub before a deferred script runs, while the loader only calls init() in a later setTimeout. SDK calls landing in that gap hit the real SDK with no client and are dropped.

For loader builds the scripts are now blocking, so they run during parsing right after loader.js and always go through the stub's queue — which also mirrors how the loader snippet is used in practice. Non-loader builds keep defer.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mydea
mydea marked this pull request as ready for review October 15, 2026 12:17
@mydea
mydea requested a review from a team as a code owner October 15, 2026 12:17
@mydea
mydea requested review from logaretm and msonnb and removed request for a team October 15, 2026 12:17
@mydea
mydea merged commit e3bb396 into develop Oct 15, 2026
67 checks passed
@mydea
mydea deleted the fix/loader-tests-deferred-scripts branch October 15, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants