Description
The global Cypress uncaught:exception handler in cypress/support/index.js contains a broken regex that inverts its intended behavior. It was meant to suppress only ResizeObserver loop limit exceeded errors but instead suppresses nearly all real JavaScript errors while failing to suppress the ResizeObserver error it targets.
This affects all 194 Cypress test files in the repository.
The bug
// cypress/support/index.js:48-54
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
Cypress.on('uncaught:exception', (err) => {
if (resizeObserverLoopErrRe.test(err.message)) {
return false;
}
});
[^(...)] in regex is a negated character class, not a negated string match. It decomposes the string into individual characters (R, e, s, i, z, O, b, etc.) and matches any message whose first character is not one of those 20 chars.
Actual behavior
| Error message |
Intended |
Actual |
ResizeObserver loop limit exceeded |
Suppressed |
NOT suppressed (first char R is in the class) |
TypeError: Cannot read properties |
Fails the test |
Suppressed (first char T is not in the class) |
SyntaxError: Unexpected token |
Fails the test |
Suppressed |
Failed to fetch |
Fails the test |
Suppressed |
DOMException: ... |
Fails the test |
Suppressed |
NetworkError: ... |
Fails the test |
Suppressed |
Impact
- Every real uncaught JavaScript error (TypeError, SyntaxError, NetworkError, etc.) is silently swallowed across all 194 test specs
- The ResizeObserver error it was meant to suppress is not suppressed
- Tests pass even when the application throws real errors, defeating the purpose of E2E testing
- Genuine application bugs are hidden behind false-positive green CI checks
Suggested fix
One-line change at cypress/support/index.js:48:
- const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
+ const resizeObserverLoopErrRe = /ResizeObserver loop/;
The handler logic stays the same — now the regex correctly matches only ResizeObserver errors, and return false suppresses only those.
Or drop regex entirely:
if (err.message.includes('ResizeObserver loop')) {
return false;
}
After fixing
Some tests may start failing because they were previously passing only due to real exceptions being silently swallowed. Those failures are genuine bugs in the application code or test setup that were being masked.
Description
The global Cypress
uncaught:exceptionhandler incypress/support/index.jscontains a broken regex that inverts its intended behavior. It was meant to suppress onlyResizeObserver loop limit exceedederrors but instead suppresses nearly all real JavaScript errors while failing to suppress the ResizeObserver error it targets.This affects all 194 Cypress test files in the repository.
The bug
[^(...)]in regex is a negated character class, not a negated string match. It decomposes the string into individual characters (R,e,s,i,z,O,b, etc.) and matches any message whose first character is not one of those 20 chars.Actual behavior
ResizeObserver loop limit exceededRis in the class)TypeError: Cannot read propertiesTis not in the class)SyntaxError: Unexpected tokenFailed to fetchDOMException: ...NetworkError: ...Impact
Suggested fix
One-line change at
cypress/support/index.js:48:The handler logic stays the same — now the regex correctly matches only ResizeObserver errors, and
return falsesuppresses only those.Or drop regex entirely:
After fixing
Some tests may start failing because they were previously passing only due to real exceptions being silently swallowed. Those failures are genuine bugs in the application code or test setup that were being masked.