[cypress] Trim long cypress configs (#167391)

## Summary 
In cypress tests, when the logs are output in the beginning, some binary
buffers are also stringified, so when looking at logs, we have to scroll
through thousands of lines of logs, that's annoying and doesn't help
debugging.

I'd like that to be somewhat more readable, there are a few options: 
- the replacer should interpret buffers as strings, try to output it
like that
   - not every binary buffer is printable
 - the replacer should redact the exact fields (certificateAuthority?)
   - too specific, might need fixing later
 - trim long arrays after 32 items
   -  I chose this as a solution

Other suggestions are welcome.

<img width="666" alt="Screenshot 2023-09-27 at 12 49 54"
src="7d35e59d-fb14-4d2a-9225-277cc2e1519b">
This commit is contained in:
Alex Szabo 2023-09-27 15:12:03 +02:00 committed by GitHub
parent 255bf6e881
commit 28fd3ff0b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -263,7 +263,17 @@ ${JSON.stringify(cypressConfigFile, null, 2)}
Cypress FTR setup for file: ${filePath}:
----------------------------------------------
${JSON.stringify(config.getAll(), null, 2)}
${JSON.stringify(
config.getAll(),
(key, v) => {
if (Array.isArray(v) && v.length > 32) {
return v.slice(0, 32).concat('... trimmed after 32 items.');
} else {
return v;
}
},
2
)}
----------------------------------------------
`);