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: use require to support config via cypress.js #15263

Merged
merged 6 commits into from
Mar 1, 2021

Conversation

lmiller1990
Copy link
Contributor

@lmiller1990 lmiller1990 commented Mar 1, 2021

User facing changelog

  • You may now write your config as cypress.js instead of cypress.json. cypress.js must confirm to the same API, for example:
module.exports = {
  video: false
}

Additional details

The eventual goal is outlined in this ticket. We need to support runner specific config files; JS is more flexible than JSON for this. The first step to supporting JS as well as JSON for configuration is to load it via require instead of fs.readJson.

How has the user experience changed?

It is still the same.

PR Tasks

N/A

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 1, 2021

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Mar 1, 2021



Test summary

182 0 5 0Flakiness 1


Run details

Project cypress
Status Passed
Commit efad917
Started Mar 1, 2021 7:15 AM
Ended Mar 1, 2021 7:23 AM
Duration 07:56 💡
OS Linux Debian - 10.5
Browser Chrome 83

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/retries.ui.spec.js Flakiness
1 runner/cypress retries.ui.spec > opens attempt on each attempt failure for the screenshot, and closes after test passes

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

@lmiller1990 lmiller1990 requested a review from a team March 1, 2021 07:32
@lmiller1990 lmiller1990 marked this pull request as ready for review March 1, 2021 07:32
@JessicaSachs JessicaSachs merged commit 24e07f6 into develop Mar 1, 2021
@JessicaSachs JessicaSachs deleted the chore/cypress-json-require branch March 1, 2021 16:04
chrisbreiding added a commit that referenced this pull request Mar 15, 2021
@chrisbreiding
Copy link
Contributor

We had to revert this for 6.7.1 in #15499 because it caused this issue: #15497.

The reason is that with the use of require, Node caches the contents of the cypress.json and we mutate the object, so subsequent requires don't read the actual contents of the file, but read from the mutated cache. I've fixed the mutation issue, since that's separate and should be fixed. But we still shouldn't use require for reading cypress.json because of the caching. If the user changes their cypress.json contents in their editor, we won't be able to read them with require because Node will always return the cached contents and not read from disk.

chrisbreiding added a commit that referenced this pull request Mar 15, 2021
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.

4 participants