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

fix: unpatch setTimeout before importing jQuery so it is not captured by zone.js #571

Merged
merged 1 commit into from
Jul 24, 2022
Merged

fix: unpatch setTimeout before importing jQuery so it is not captured by zone.js #571

merged 1 commit into from
Jul 24, 2022

Conversation

arturovt
Copy link
Contributor

Hey Netanel.

I've been facing issues with fakeAsync and spectator during a long time, but I was thinking we're doing something wrong in unit tests. The issue has been happening so randomly, like in 1 of 10 cases, so I couldn't capture it. The tests were basically failing with 1 timer(s) still in the queue.. So after debugging zone.js onScheduleTask I've found that the task, which is being scheduled, is $.ready.

See the code:
https:/jquery/jquery/blob/5d5ea015114092c157311c4948f7cc3d8c8e7f8a/src/core/ready.js#L64-L70

I don't know if there's any other way to fix that issue and to force jquery not to schedule a timer. So I just unpatched the setTimeout before requiring jquery and then reset it back.

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