Restrict Cypress uncaught exception suppression to known benign errors

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
2026-03-08 13:49:51 +08:00
parent fc43ca67ca
commit d5464ebc2d
3 changed files with 62 additions and 3 deletions

View File

@@ -20,9 +20,11 @@
// Import commands.js using ES2015 syntax:
import "./commands";
Cypress.on("uncaught:exception", (err, runnable) => {
// returning false here prevents Cypress from failing the test
return false;
import { getCypressUncaughtExceptionDecision } from "./uncaughtExceptionPolicy";
Cypress.on("uncaught:exception", (error) => {
// Ignore only known benign browser/runtime noise; fail all other app errors.
return getCypressUncaughtExceptionDecision(error);
});
// Alternatively you can use CommonJS syntax: