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

fix: prevent vite from crashing where there are no support files or specs found #17624

Merged
merged 3 commits into from
Aug 6, 2021

Conversation

elevatebart
Copy link
Contributor

@elevatebart elevatebart commented Aug 5, 2021

When there is no values, in the optimization array,
supportFile can be a boolean. the final optimized entry passed to
fast-glog is then [false] whic crashes cypress.

This protects against the no-spec issue

closes #17373

How to reproduce

  • create a vite app (yarn create vite-app)
  • create cypress component testings around it (yarn create cypress-tests)
  • in the cypress.json set supportFile to false and make sure there is no spec files.

Here is the crash.

When there is no values, in the optimization array,
supportFile can be a boolean. the final optimized entry passed to
fast-glog is then `[false]` whic crashes cypress.

This protects against the no-spec issue

closes #17373
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 5, 2021

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Aug 5, 2021



Test summary

4183 0 50 2Flakiness 0


Run details

Project cypress
Status Passed
Commit 7b012b2
Started Aug 6, 2021 8:14 PM
Ended Aug 6, 2021 8:24 PM
Duration 10:03 💡
OS Linux Debian - 10.8
Browser Chrome 92

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

@JessicaSachs JessicaSachs changed the title fix: no supportfile + no specs, vite don't crash fix: prevent vite from crashing where there are no support files or specs found Aug 5, 2021
@@ -59,7 +59,9 @@ const resolveServerConfig = async ({ viteConfig, options }: StartDevServerOption
// Ask vite to pre-optimize all dependencies of the specs
finalConfig.optimizeDeps = finalConfig.optimizeDeps || {}

finalConfig.optimizeDeps.entries = [...options.specs.map((spec) => spec.relative), supportFile]
if (options.specs.length || supportFile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably make sure that if specs is undefined, make sure that we don't crash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I'll add this protection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 7b012b2

@elevatebart elevatebart dismissed a stale review via 7b012b2 August 6, 2021 16:13
@elevatebart elevatebart merged commit ae0ea87 into develop Aug 6, 2021
elevatebart pushed a commit that referenced this pull request Aug 6, 2021
…pecs found (#17624)

* fix: no supportfile + no specs, vite don't crash

When there is no values, in the optimization array,
supportFile can be a boolean. the final optimized entry passed to
fast-glog is then `[false]` whic crashes cypress.

This protects against the no-spec issue

closes #17373

* fix: protect startServer from undefined specs
elevatebart pushed a commit that referenced this pull request Aug 10, 2021
#17641)

* fix: prevent vite from crashing where there are no support files or specs found (#17624)

* fix: no supportfile + no specs, vite don't crash

When there is no values, in the optimization array,
supportFile can be a boolean. the final optimized entry passed to
fast-glog is then `[false]` whic crashes cypress.

This protects against the no-spec issue

closes #17373

* fix: protect startServer from undefined specs

* fix: when there are specs but the supportFile is undefined
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.

TypeError when launching cypress open-ct
3 participants