Skip to content

Commit

Permalink
test: ignore more ResizeObserver errors
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Jul 4, 2024
1 parent efd63e2 commit 1827fd1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import './commands.js'

const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/
Cypress.on('uncaught:exception', (err) => {
// This prevents a benign error:
// This error means that ResizeObserver was not able to deliver all
// observations within a single animation frame. It is benign (your site
// will not break).
//
// Source: https://stackoverflow.com/a/50387233/1319140
if (resizeObserverLoopErrRe.test(err.message)) {
// returning false here prevents Cypress from failing the test
const errMsg = err.toString()

if (
errMsg.match(/ResizeObserver loop limit exceeded/) ||
errMsg.match(
/ResizeObserver loop completed with undelivered notifications/
)
) {
return false
}
})
Expand Down

0 comments on commit 1827fd1

Please sign in to comment.