`blockHosts` test configuration override failing to apply
See original GitHub issueCurrent behavior
Hello, I’ve been troubleshooting some strange behavior when leveraging the blockHosts
configuration value and overriding the value with the Test Specific Configuration options.
Steps/setup:
blockHosts
entry is added to thecypress.json
configuration file as a string value (also tried an array with single string)- added an override for a test suite to set the
blockHosts
entry tonull
(the default)describe('my suite', {blockHosts: null}, () => {});
Current setup:
// cypress.json
{ "blockHosts": "*.pendo.io" }
// integration/my-suite.test.js
describe('my suite', {blockHosts: ''}, () => {});
The specific my suite
test suite continues to block requests to pendo.io
.
What I’ve identified thus far:
- config is set properly (confirmed the settings GUI)
- logged the
Cypress.config()
value and confirmed thatblockHosts
is mutated to be an empty string - The
x-cypress-matched-blocked-host
gets set with the originalblockHosts
value
I have tried with various different values for the blockHosts
and also tried using the Cypress.config
API directly but experienced the same behavior. From my understanding the blockHosts
configuration value is not one of the read only configuration options.
Desired behavior
When providing blockHosts
as a configuration value for a test suite, it should override the current blockHosts
value and the cypress test should respect the new blockHosts
value. This same override should be applicable using Cypress.config('blockHosts', '')
Test code to reproduce
https://github.com/cbourdage/cypress-test-tiny/pull/1
I have been able to replicate this in 2 repos now so you should be able to use any existing tests to try to override the blockHosts
configuration option.
Cypress Version
9.3.1
Other
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:8 (1 by maintainers)
Top GitHub Comments
I’m on v10.4.0 and have similar issue, blockHosts seems not working correctly.
blockHosts should override the config via a test config override. Looks like a bug. I’m not sure that we have tests for this internally (couldn’t find them quickly).