Bugzilla – Attachment 186968 Details for
Bug 40809
JS warning should make Cypress tests fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40809: Display the whole error
Bug-40809-Display-the-whole-error.patch (text/plain), 1.74 KB, created by
Jonathan Druart
on 2025-09-26 10:38:24 UTC
(
hide
)
Description:
Bug 40809: Display the whole error
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-09-26 10:38:24 UTC
Size:
1.74 KB
patch
obsolete
>From 4d140d3fbd24507c82f9b8b6564242dab0dd60e3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 26 Sep 2025 12:38:00 +0200 >Subject: [PATCH] Bug 40809: Display the whole error > >Not only the first line >--- > t/cypress/support/e2e.js | 26 ++++++++++++++++---------- > 1 file changed, 16 insertions(+), 10 deletions(-) > >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index e5062f748c3..a84b4872a2a 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -25,20 +25,26 @@ > // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) > > // Error on JS warnings >+function safeToString(arg) { >+ try { >+ return JSON.stringify(arg); >+ } catch (e) { >+ return `[object ${arg.constructor?.name || typeof arg}]`; >+ } >+} >+ >+function stringifyArgs(args) { >+ return args.map(safeToString).join(" "); >+} > Cypress.on("window:before:load", win => { > win.console.warn = (...args) => { >- if (args[0] && typeof args[0] === "string") { >- throw new Error(`JS Warning detected: ${args[0]}`); >- } >+ const message = stringifyArgs(args); >+ throw new Error(`JS Warning detected: ${message}`); > }; > win.console.log = (...args) => { >- if (args[0] && typeof args[0] === "string") { >- if (args[0].match(/DataTables warning: /)) { >- throw new Error( >- `DataTables warning detected in log: ${args[0]}` >- ); >- } >- console.log(args[0]); >+ const message = stringifyArgs(args); >+ if (message.match(/DataTables warning: /)) { >+ throw new Error(`DataTables warning detected in log: ${message}`); > } > }; > }); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40809
:
186401
|
186951
|
186966
|
186967
|
186968
|
186969
|
186977