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: allow use of javascript in config file #18061

Merged
merged 68 commits into from
Sep 23, 2021
Merged

Conversation

elevatebart
Copy link
Contributor

@elevatebart elevatebart commented Sep 10, 2021

Closes https://cypress-io.atlassian.net/browse/UNIFY-346

Preamble

As discussed with @jennifer-shehane on Sep 9th 2021, this PR is the first of a series of PRs to get to the cypress.config.ts new syntax. This is a follow-up to #17000.

Here is the list of discreet changes that will be merged as gradually as possible into develop:

First, these will not change end-user experience

  • Allow cypress.config.js with the exact same data schema as a custom config file
  • Allow cypress.config.js as a default config file
  • Allow the use of TypeScript for configuring cypress cypress.config.ts
  • Add the defineConfig() function to facilitate configuration in a JavaScript file
  • Add the setupNodeEvents() config to configure plugins in the cypress.config.js file
    • Error when using a pluginsFile with cypress.config.js
  • Add the component.devServer() + component.devServerOptions to streamline configuration of component testing.
  • Make warnings visible in component testing when there is any.

Then changing the defaults and adding warning

  • Warn when still using cypress.json
    • in the terminal
    • in the desktop-gui
    • in the component testing interface
  • Change initial default scaffolding from using cypress.json and plugins/index.js to using cypress.config.js

User facing changelog

  • One can now use JavaScript to define the content of what was before in the cypress.json file. Use the option --config-file my.config.for.cypress.js to specify where your file is.

Additional details

  • Chokidar update was necessary for watching cypress.config.js properly

To test

Create a project with a js file as the config file

yarn create vite test-project
cd text-project
yarn create cypress-tests
mv cypress.json cypress.config.custom.js

Then open cypress.config.custom.js and write module.exports = { viewportWidth:300 } in it.

yarn cypress open --config-file cypress.config.custom.js

PR Tasks

  • Have tests been added/updated?

@elevatebart elevatebart requested a review from a team as a code owner September 10, 2021 18:17
@elevatebart elevatebart requested review from jennifer-shehane and kuceb and removed request for a team September 10, 2021 18:17
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 10, 2021

Thanks for taking the time to open a PR!

@elevatebart elevatebart marked this pull request as draft September 10, 2021 18:26
@elevatebart elevatebart marked this pull request as ready for review September 10, 2021 20:52
This reverts commit ff3baa1.
@cypress
Copy link

cypress bot commented Sep 10, 2021



Test summary

4189 0 50 2Flakiness 1


Run details

Project cypress
Status Passed
Commit 9c6b625
Started Sep 22, 2021 6:27 PM
Ended Sep 22, 2021 6:37 PM
Duration 09:53 💡
OS Linux Debian - 10.9
Browser Chrome beta 94

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/e2e/redirects_spec.js Flakiness
1 redirection > meta > binds to the new page after a timeout

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

@elevatebart elevatebart marked this pull request as draft September 12, 2021 14:09
@elevatebart elevatebart marked this pull request as draft September 21, 2021 20:04
@jennifer-shehane
Copy link
Member

Updating from develop since we fixed the intercept flaky tests. Hopefully this should help determine flake from failures.

@elevatebart elevatebart marked this pull request as ready for review September 22, 2021 16:10
Copy link
Contributor

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

This looks good to me. I thoroughly tested the e2e runner.

@JessicaSachs
Copy link
Contributor

This looks good @jennifer-shehane. Ready to go as soon as you give your 👍.

@elevatebart elevatebart merged commit dedb05a into develop Sep 23, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 27, 2021

Released in 8.5.0.

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

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Sep 27, 2021
@elevatebart elevatebart deleted the feat/allow-eval-config branch March 24, 2022 18:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants