Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create config package for config validation #18589

Merged
merged 75 commits into from Nov 9, 2021

Conversation

emilyrohrbough
Copy link
Member

@emilyrohrbough emilyrohrbough commented Oct 21, 2021

This change creates a packages/config package which provides the list of configuration options and their default values and validation functions. The majority of this work has been extracting the existing configuration logic out of the packages/server module so it could also be used by the packages/driver module during in-test configuration updates made via Cypress.config.

User facing changelog

Add validation to in-test configuration updates made with Cypress.config.

How has the user experience changed?

User will be shown an error message if their tests attempts to update the cypress configuration with an invalid value. Previously, the configuration would silently be updated and could cause un-expected behaviors or appear to be broken.

Example as seen in #2918, setting the baseUrl to an ' ' is not a valid baseUrl value. After this change the following would be displayed:

Screen Shot 2021-10-21 at 10 12 18 AM

PR Tasks

  • Have tests been added/updated?
  • Has the original issue or this PR been tagged with a release in ZenHub?
  • Has a PR for user-facing changes been opened in cypress-documentation?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 21, 2021

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Oct 21, 2021



Test summary

4233 0 50 2Flakiness 0


Run details

Project cypress
Status Passed
Commit 1414fd7
Started Nov 9, 2021 7:11 PM
Ended Nov 9, 2021 7:22 PM
Duration 10:57 💡
OS Linux Debian - 10.9
Browser Electron 93

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

@emilyrohrbough emilyrohrbough changed the title (feat): create config package for config validation feat: create config package for config validation Oct 21, 2021
@emilyrohrbough emilyrohrbough marked this pull request as ready for review October 25, 2021 15:16
@emilyrohrbough emilyrohrbough requested a review from a team as a code owner October 25, 2021 15:16
@emilyrohrbough emilyrohrbough requested review from flotwig and mjhenkes and removed request for a team October 25, 2021 15:16
@jennifer-shehane jennifer-shehane requested review from chrisbreiding and removed request for flotwig October 25, 2021 15:18
flotwig
flotwig previously approved these changes Nov 8, 2021
@@ -160,7 +160,7 @@ export default function (Commands, Cypress, cy, state, config) {
// stuff, or handling this in the runner itself?
// Cypress sessions will clear cookies on its own before each test
Cypress.on('test:before:run:async', () => {
if (!Cypress.config.experimentalSessionSupport) {
if (!Cypress.config('experimentalSessionSupport')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this causing a bug? since before this condition would always pass

@flotwig
Copy link
Contributor

flotwig commented Nov 8, 2021

@emilyrohrbough if this is breaking, the base branch should be updated to 9.0.0-release

@flotwig flotwig added type: breaking change Requires a new major release version and removed type: breaking change Requires a new major release version labels Nov 8, 2021
@emilyrohrbough emilyrohrbough changed the base branch from develop to 9.0-release November 8, 2021 17:01
@emilyrohrbough emilyrohrbough merged commit 99c8d46 into 9.0-release Nov 9, 2021
@emilyrohrbough emilyrohrbough deleted the add-config-validation branch November 9, 2021 19:19
tgriesser added a commit that referenced this pull request Nov 18, 2021
* develop: (329 commits)
  chore: Update Chrome (stable) to 96.0.4664.45 (#18931)
  fix: Loading of specs with % in the filename (#18877)
  chore: refactor `create` into class `$Cy` (#18715)
  chore: Update Chrome (beta) to 96.0.4664.45 (#18891)
  fix: flaky `system-tests-firefox` job (#18848)
  release 9.0.0
  feat: ensure major release
  have conduit app wait on localhost:3000
  fix install-required-node
  use --legacy-peer-deps
  feat: ensure major release
  fix darwin node install
  chore(driver): fix integration test retry configuration (#18643)
  feat(deps): update dependency electron to v15 🌟 (#18317)
  chore: Bind this correctly when setting response headers with cy.route() (#18859)
  feat: create config package for config validation (#18589)
  chore: patch `winston` to suppress `padLevels` warning (#18824)
  chore: test out major release build
  fix: remove outdated npm registry links (#18727)
  fix: Adding an existing command with `Cypress.Commands.add()` will throw an error (#18587)
  ...
@davidmunechika davidmunechika restored the add-config-validation branch April 1, 2022 00:53
@davidmunechika davidmunechika deleted the add-config-validation branch April 1, 2022 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change baseUrl during test (set to null) in order to visit local file instead of URL
5 participants