Better handle reserved key CYPRESS_ENV being set by users to valid values#6437
Merged
Conversation
Contributor
|
Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.
PR Review ChecklistIf any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'. User Experience
Functionality
Maintainability
Quality
Internal
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
# Conflicts: # cli/lib/cli.js # yarn.lock
bahmutov
reviewed
Mar 5, 2020
|
|
||
| if (!util.isValidCypressEnvValue(process.env.CYPRESS_ENV)) { | ||
| debug('invalid CYPRESS_ENV value', process.env.CYPRESS_ENV) | ||
| const CYPRESS_INTERNAL_ENV = process.env.CYPRESS_INTERNAL_ENV |
Contributor
There was a problem hiding this comment.
just to avoid repetition
const {CYPRESS_INTERNAL_ENV} = process.env
bahmutov
previously approved these changes
Mar 5, 2020
Contributor
bahmutov
left a comment
There was a problem hiding this comment.
nice, will avoid the unnecessary confusion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CYPRESS_ENVwith non production value #6436User facing changelog
CYPRESS_INTERNAL_ENVto a non-production value.Additional details
CYPRESS_ENVvariable toCYPRESS_INTERNAL_ENV. The use of this keyword is not frequent, but the consequences of accidentally setting it are complete blocker for users trying to record and it a real headache to debug from within support.undefinedwhich will set our default and I don't suspect anyone would set 'undefined' anyway.See https://github.com/cypress-io/cypress-services/issues/2194
How has the user experience changed?
Before: Can't find projectID
The most optimistic error is that it can't find the projectId (because the project doesn't exist in staging) - this results in a string of emails to support because their project definitely exists!
Before: recording to staging db 😬
If their project is found, it could just record to staging - this results in a string of emails to support because they see it recording but do not see the recordings in their Dashboard!
After:
The
CYPRESS_ENVis now `CYPRESS_INTERNAL_ENV, which is less likely to be set by users for their own use.After: Warning when setting to not
productionorundefinedPR Tasks
cypress-documentation? Add note about reserved CYPRESS_INTERNAL_ENV env var cypress-documentation#2587type definitions?cypress.schema.json?