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(driver): suppress ResizeObserver warning #20284
Conversation
Thanks for taking the time to open a PR!
|
Follow up on comment from @marktnoonan in #20257 (comment)
Both your comments kind of hint at the current solution: asking people to add a copy-paste code like we have been for years. It satisfies (1) show in the command log and (2) opt out (don't have the snippet). I don't think this is ideal - at least from my understanding, this warning is meaningless in all situations. I couldn't find any examples where this warning was stopping me from missing an infinite loop, or blocking render, etc. |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
After doing more reading about this error, I'm conflicted about our role here.
So while it does course correct, it seems like this is still a correctable issue, in that something must be causing the loop to occur by changing/mutating a higher node during a lower node's observer handler. I'm curious if the linked spec in the description doesn't have an actual issue that could be corrected. I think the years of "it's not a real problem" has created a bit of a hot potato where we have lots of "problematic" implementations in open source libs today and it can be hard to track down the true causes. The fact that everything seems to work out post-error means that it's just been easier to ignore. Which to be fair I think is a reasonable approach, given the minimal impact, but not necessarily one I think we want to assume for everyone. But the question here is whether it makes sense to show up in the command log at all. And I want to say no, it doesn't, but at the same time it's hard for me to recommend handling this exception differently than any other. Would it make sense to allow for the suppression of this through config? This would tacitly say "Hey, we realize that the ResizeObserver throws some errors that our users tend to ignore, we can make ignoring them easier for you if you choose to enable this". I'm not a big fan of adding config for everything, either, but this is a fairly unique scenario. |
@tbiethman Good points and description. Basically it boils down to:
How would this look as a config option? export default defineConfig({
suppressExceptions: ['ResizeObserver']
}) Or something like this? Would it be opt-in or opt-out? We'd display a My main concern is, as described here some libraries (like Ant Design's One important thing to note: our |
Wouldn't this allow infinite loops from buggy
IMO we should avoid adding things like this to For example, you could have a |
The bigger question and really only question is understanding why resize observer throws in a cypress environment outside a normal environment. Fixing that would obviate the need to change anything. |
We will
If it turns out this is very common, we can reconsider swallowing the error, but it sounds like the ideal scenario would be understanding why this happens in as @brian-mann suggested. Unless it's very prevalent in CT, we won't add this fix here, but instead recommend a workaround using |
Thanks a lot for the PR and effort @lmiller1990. I came across the |
This commit addresses false negative failures in Cypress due to a known Chrome issue. The included change prevents Cypress tests from failing because of the non-critical `ResizeObserver loop limit exceeded` error, which occurs inconsistently during CI/CD runs with GitHub runners. This error has been documented in CHrome and does not affect actual browser usage or local test runs. This commit implements a widely recommended workaround that ignores this specific error during test execution. Error from Cypress: ``` Error: The following error originated from your application code, not from Cypress. > ResizeObserver loop limit exceeded ``` The solution follows community-driven advice and past discussions on handling this benign exception within test scenarios. It contributes to more reliable CI/CD results by filtering out irrelevant error noise. For detailed background and discussion on this error, see: - Cypress issues: cypress-io/cypress#8418, cypress-io/cypress#20341 - Cypress PRs: cypress-io/cypress#20257, cypress-io/cypress#20284 - Discussion in Quasar: quasarframework/quasar#2233 - Discussion in specification repository: WICG/resize-observer#38
This commit addresses false negative failures in Cypress due to a known Chrome issue. The included change prevents Cypress tests from failing because of the non-critical `ResizeObserver loop limit exceeded` error, which occurs inconsistently during CI/CD runs with GitHub runners. This error has been documented in CHrome and does not affect actual browser usage or local test runs. This commit implements a widely recommended workaround that ignores this specific error during test execution. Error from Cypress: ``` Error: The following error originated from your application code, not from Cypress. > ResizeObserver loop limit exceeded ``` The solution follows community-driven advice and past discussions on handling this benign exception within test scenarios. It contributes to more reliable CI/CD results by filtering out irrelevant error noise. For detailed background and discussion on this error, see: - Cypress issues: cypress-io/cypress#8418, cypress-io/cypress#20341 - Cypress PRs: cypress-io/cypress#20257, cypress-io/cypress#20284 - Discussion in Quasar: quasarframework/quasar#2233 - Discussion in specification repository: WICG/resize-observer#38
User facing changelog
Suppress
ResizeObserver loop limit exceeded
error.Additional details
Since the early days, using
ResizeObserver
in your code often leads toResizeObserver loop limit exceeded
errors in Cypress when using Chrome. It's a Chrome specific error.It's generally understood as safe to ignore this error, as we recommend multiple times:
My understanding is this error triggers when
ResizeObsever#observe
is called more than once in a singlerequestAnimationFrame
, which isn't really a fatal error that should cause a test failure.This reason I added this into Cypress core is it's blocking some of our own CT examples, see this issue. Rather than telling people to "safely ignore it" and copy-paste a snippet, I figure it makes sense to include it, so they don't need to. Instead, we print a
console.warn
.It's worth noting our own code base also intentionally ignores this - this spec cannot run due to
ResizeObserver
loop error, which is why we added the common accepted work-around here.How has the user experience changed?
Before (with work-around):
After:
No need for copy-pasting
in your support file.
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?