DEV Community

Discussion on: Muting Noisy XHR Logs in Cypress

Collapse
 
jprealini profile image
Juan Pablo

Hi! I found this article very helpful, but for some reason I faced an issue when adding the code to the support/index.js file... Cypress was telling me that there was no override for that option... I figured that probably I needed to change something in the Cypress core code to allow it to identify the custom key in the cypress.json file. So what I did was adding the hideXHR key to my "env": { } section, and then in the code instead of

if (Cypress.config('hideXHR'))
Enter fullscreen mode Exit fullscreen mode

I put

if (Cypress.env('hideXHR'))
Enter fullscreen mode Exit fullscreen mode

And it worked as expected

Thanks!

Collapse
 
samelawrence profile image
Sam E. Lawrence

If you're placing the config inside your env object, then yes that's necessary. I keep my config flag outside of the env object, in the main e2e config object. I believe it's optional where you keep it, as long as both pieces of code match.