-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Conversation
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
Thanks for taking the time to open a PR!
|
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 |
@@ -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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 7b012b2
…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
#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
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
yarn create vite-app
)yarn create cypress-tests
)cypress.json
setsupportFile
tofalse
and make sure there is no spec files.Here is the crash.