Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(loader): Update Loader Script & test error in sentryOnLoad #13952

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Oct 11, 2024

Updates the loader & adds tests for getsentry/sentry#78993

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Good change! Left a comment in getsentry/sentry#78993 (comment) but apart from that I think this is good to go.

async ({ getLocalTestUrl, page }) => {
const url = await getLocalTestUrl({ testDir: __dirname });
const req = await waitForErrorRequestOnUrl(page, url);

Copy link
Member

Choose a reason for hiding this comment

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

l: we could assert on the console output here so that we ensure that the error is logged, wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated this to assert on the error message!

mydea added a commit to getsentry/sentry that referenced this pull request Oct 14, 2024
If a user has an error in their `sentryOnLoad` function for the Loader
Script, we do try-catch it today, but we stop any further processing,
leading to possible issues down the line (e.g. errors not being sent to
Sentry etc).

This PR changes this so that we catch errors in this first, and continue
if it happens. This means that we'll still do the default
`Sentry.init()` and send the error that triggered lazy loading to Sentry
- this was previously swallowed by the catch.

Closes getsentry/sentry-javascript#13939

Test added here:
getsentry/sentry-javascript#13952
@mydea mydea merged commit e1d7a9d into develop Oct 14, 2024
136 checks passed
@mydea mydea deleted the fn/add-tests-loader branch October 14, 2024 06:38
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