Cypress: Array in environment variables CYPRESS_BLACKLIST_HOSTS, CYPRESS_testFiles not handled correctly

Created on 23 Mar 2020  路  6Comments  路  Source: cypress-io/cypress

Current behavior:

Setting multiple hosts via the environment variable CYPRESS_BLACKLIST_HOSTS as an array leads to them not picked up corretly.

Example:

export CYPRESS_BLACKLIST_HOSTS=["www.google-analytics.com","*.hotjar.com"]

The environment variable is always handled as a string

Desired behavior:

The desired behavior is to analyze if an array was provided and handled each item separately.

Test code to reproduce

export CYPRESS_BLACKLIST_HOSTS=["www.google-analytics.com","*.hotjar.com"]

cypress open

Versions


Node.js Version 12.8.1
Cypress Version 4.1.0

鈹咺ssue is synchronized with this Jira Bug by Unito

cli first-timers-only internal-priority bug

All 6 comments

Can confirm, this is resolved as a string when passed as an array in via environment variables.

CYPRESS_BLACKLIST_HOSTS=["www.google-analytics.com","*.hotjar.com"] cypress open

Screen Shot 2020-03-23 at 4 36 03 PM copy

This is the only configuration value passable via CYPRESS_ that accepts a non string or number, so I imagine we're just not handling it at all.

Looks like there is at least one other array-based CYPRESS_ env var that behaves incorrectly: CYPRESS_testFiles.

CYPRESS_testFiles="[\"**/196*\", \"**/475*\", \"**/476*\"]" npx cypress open

Screen Shot 2020-07-16 at 1 57 24 PM

Would I be able to work on this issue? If so I had a few questions since I am new at contributing open source.
1) Where should I look in the codebase to address this issue, specifically where environment variables are parsed?
2) How would I be able to debug and test my changes locally?

@dmoini Check out our contributing doc for general guidance on running changes and tests locally. Generally, part of the work to parse env vars prefixed with CYPRESS_ is done in our config.js here https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/config.js#L930:L930

The code for this is done in cypress-io/cypress#8151, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

Released in 5.0.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.0.0, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings