mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-15 03:31:18 -06:00
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
This commit is contained in:
committed by
GitHub
parent
750ea59a1f
commit
ae0ea87802
@@ -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 && options.specs.length) || supportFile) {
|
||||
finalConfig.optimizeDeps.entries = [...options.specs.map((spec) => spec.relative), supportFile]
|
||||
}
|
||||
|
||||
debug(`the resolved server config is ${JSON.stringify(finalConfig, null, 2)}`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user