Since Cypress.io starts a browser to run the end-to-end tests, your Google Analytics tracking calls (also from other analytics services like plausible.io) are made, and you don’t want to have wrong analytics.
Looking through cypress’ documentation I finally found the
blacklistHosts option that can be specified in your
cypress.json configuration file.
*.google-analytics.com by adding an entry to
cypress.json like this:
But I want to specify more than one host to block
blacklistHosts as an array, as the documentation says
By passing a string or array of strings you can block requests made to one or more hosts.
For example, to block calls to
*.plausible.io, simply write:
"blacklistHosts": ["*.google-analytics.com", "*.plausible.io"]