Update Vite examples to v5
Suggestion
This is an enhancement suggestion to update the following examples, currently using Vite v4, to use Vite v5 (see announcement Vite 5.0 is out! Nov 16, 2023):
| Directory | Current Vite Version |
|---|---|
| examples/component-tests | 4.5.x |
| examples/wait-on-vite | 4.5.x |
Reason
cypress-io/github-action examples should show successful use with latest published version of Vite
Prerequisites
Component Testing example
-
Update @vitejs/plugin-react to minimum v4.2.0 to avoid peer dependency warning regarding Vite
v5 -
Rename examples/component-tests/vite.config.js to
vite.config.mjs(see Deprecate CJS Node API) -
Resolve Cypress feature request https://github.com/cypress-io/cypress/issues/28347. Without this enhancement to Cypress,
npx cypress run --componentdoes successfully run, however it outputs the following warnings:The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. We detected that you have versions of dependencies that are not officially supported: - `vite`. Expected ^2.0.0 || ^3.0.0 || ^4.0.0, found 5.0.0. If you're experiencing problems, downgrade dependencies and restart Cypress.
E2E example
- This enhancement should be deferred until Cypress officially supports Vite
v5- see https://github.com/cypress-io/cypress/issues/28347
- See PR https://github.com/cypress-io/github-action/pull/1185
- Cypress 13.10.0 supports Vite v5 for component testing.
- Deferring implementation in this repo until https://github.com/cypress-io/cypress/issues/29557 is resolved (Edit: not yet resolved, but went ahead with update anyway.)
- PR #1231 submitted, despite open Cypress issue https://github.com/cypress-io/cypress/issues/29557