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: Fix flaky onunhandledrejection tests #3482

Merged
merged 1 commit into from Apr 30, 2021
Merged

test: Fix flaky onunhandledrejection tests #3482

merged 1 commit into from Apr 30, 2021

Conversation

kamilogorek
Copy link
Member

@kamilogorek kamilogorek commented Apr 29, 2021

@kamilogorek kamilogorek requested review from , ahmedetefy and iker-barriocanal and removed request for Apr 29, 2021
@github-actions
Copy link

@github-actions github-actions bot commented Apr 29, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.63 KB (-0.02% 🔽)
@sentry/browser - Webpack 21.5 KB (0%)
@sentry/react - Webpack 21.53 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 27.92 KB (-0.01% 🔽)

Copy link
Contributor

@rhcarvalho rhcarvalho left a comment

Do we have examples of the flakiness in CI (to document in the PR description)?

import { OnUnhandledRejection } from '../src/integrations/onunhandledrejection';

jest.mock('@sentry/hub', () => {
// we just want to short-circuit it, so dont worry about types
Copy link
Contributor

@rhcarvalho rhcarvalho Apr 29, 2021

Choose a reason for hiding this comment

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

I understand the rest of the change, don't fully understand this.

Why do we want to short-circuit?

Copy link
Member Author

@kamilogorek kamilogorek Apr 29, 2021

Choose a reason for hiding this comment

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

Because setupOnce is checking whether an integration is installed, which in the case of these tests should always be the case. I think this was the reason for flakyness, because hub is attached to the global object.

import { Scope } from '@sentry/core';
import { Hub } from '@sentry/hub';
Copy link
Contributor

@rhcarvalho rhcarvalho Apr 29, 2021

Choose a reason for hiding this comment

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

For my learning -- Does changing this import affect the test, or is it just cosmetic/preference?

Copy link
Member Author

@kamilogorek kamilogorek Apr 29, 2021

Choose a reason for hiding this comment

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

Cosmetic preference

@kamilogorek
Copy link
Member Author

@kamilogorek kamilogorek commented Apr 29, 2021

Linked an example

@kamilogorek kamilogorek requested a review from rhcarvalho Apr 29, 2021
@HazAT HazAT merged commit 35f9eb1 into master Apr 30, 2021
15 checks passed
@HazAT HazAT deleted the fix-flaky-test branch Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants