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

breaking: remove support for vite 2 and 3 from @cypress/vite-dev-server #30489

Merged
merged 27 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c6d5bf0
chore: update system tests for vite 4 and 5 to latest [run ci]
AtofStryker Oct 28, 2024
1fb5074
chore: remove projects vite 2.8.6, 2.9.1, vite3.0.2 as they are no lo…
AtofStryker Oct 28, 2024
2f98064
chore: update vite-ct-function-api system tests to latests
AtofStryker Oct 28, 2024
aa2050c
chore: update vite-ct-object-api system tests to latests
AtofStryker Oct 28, 2024
f52481e
chore: update vite-simple system tests to latests
AtofStryker Oct 28, 2024
9124023
breaking: remove support for vite 2 and 3 [run ci]
AtofStryker Oct 28, 2024
11f0a36
update react-vite-ts-configured to latest deps
AtofStryker Oct 28, 2024
83c4261
update react-vite-ts-unconfigured to latest deps
AtofStryker Oct 28, 2024
694385f
update vue2 to latest (to be removed later in v14)
AtofStryker Oct 28, 2024
678b9a1
update vue3-vite-ts-configured to latest deps (need to fix typings is…
AtofStryker Oct 28, 2024
78d7286
update vue3-vite-ts-unconfigured to latest deps
AtofStryker Oct 28, 2024
47c9f0d
update vue3-vite-ts-custom-index-html to latest deps (need to fix typ…
AtofStryker Oct 28, 2024
a7fec73
update vue3 to latest deps
AtofStryker Oct 28, 2024
00e60b1
update detection spec to be compatible with latest compatible deps. r…
AtofStryker Oct 28, 2024
1bde344
add changelog
AtofStryker Oct 29, 2024
6c8df83
chore: update react-vite-ts-configured
AtofStryker Oct 29, 2024
e0e361f
update svelte vite
AtofStryker Oct 29, 2024
3b4c8a4
update ct-public-api-solid-js
AtofStryker Oct 29, 2024
1fe87dc
update system test vite dependencies
AtofStryker Oct 30, 2024
ecf3fe0
update comments on typings issues and missed dependencies [run ci]
AtofStryker Oct 30, 2024
e8d6352
add addresses section [run ci]
AtofStryker Oct 30, 2024
656fd22
update lock file for component-testing-outdated-dependencies [run ci]
AtofStryker Oct 30, 2024
f9201e1
update lock file [run ci]
AtofStryker Oct 30, 2024
0065168
update missed yarn lock file [run ci]
AtofStryker Oct 30, 2024
f105854
fix issues inside vue2 project package not using correct dependencies…
AtofStryker Oct 30, 2024
1135b68
fix issues with failing vds test [run ci]
AtofStryker Oct 30, 2024
149f592
fix failing tests in vite-dev-server by fixing source map references …
AtofStryker Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ _Released 12/3/2024 (PENDING)_
- Upgraded bundled Node.js version from `18.17.0` to `20.18.0`. Addresses [#29547](https://github.com/cypress-io/cypress/issues/29547).
- It is no longer possible to make a `fetch` or `XMLHttpRequest` request from the `about:blank` page in Electron (i.e. `cy.window().then((win) => win.fetch('<some-url>')`). You must use `cy.request` instead or perform some form of initial navigation via `cy.visit()`. Addressed in [#29547](https://github.com/cypress-io/cypress/pull/30394).
- `@cypress/webpack-dev-server` no longer supports `webpack-dev-server` version 3. Additionally, `@cypress/webpack-dev-server` now ships with `webpack-dev-server` version 5 by default. `webpack-dev-server` version 4 will need to be installed along side Cypress if you are still using `webpack` version 4. Addresses [#29308](https://github.com/cypress-io/cypress/issues/29308), [#30347](https://github.com/cypress-io/cypress/issues/30347), and [#30141](https://github.com/cypress-io/cypress/issues/30141).
- `@cypress/vite-dev-server` no longer supports `vite` versions 2 and 3. Addresses [#29377](https://github.com/cypress-io/cypress/issues/29377) and [#29378](https://github.com/cypress-io/cypress/issues/29378)

**Bugfixes:**

Expand Down
2 changes: 1 addition & 1 deletion npm/vite-dev-server/cypress/e2e/react.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dedent from 'dedent'

type ProjectDirs = typeof fixtureDirs

const VITE_REACT: ProjectDirs[number][] = ['vite2.8.6-react', 'vite2.9.1-react']
const VITE_REACT: ProjectDirs[number][] = ['vite4.5.5-react', 'vite5.4.10-react']

// Add to this list to focus on a particular permutation
const ONLY_PROJECTS: ProjectDirs[number][] = []
Expand Down
27 changes: 14 additions & 13 deletions npm/vite-dev-server/cypress/e2e/vite-dev-server.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,23 @@ describe('Config options', () => {
})

it('supports supportFile = false', () => {
cy.scaffoldProject('vite2.9.1-react')
cy.openProject('vite2.9.1-react', ['--config-file', 'cypress-vite-no-support.config.ts', '--component'])
cy.scaffoldProject('vite5.4.10-react')
cy.openProject('vite5.4.10-react', ['--config-file', 'cypress-vite-no-support.config.ts', '--component'])
cy.startAppServer('component')

cy.visitApp()
cy.specsPageIsVisible()
cy.contains('App.cy.jsx').click()
cy.waitForSpecToFinish()
cy.get('.passed > .num').should('contain', 1)
// no support file means there is no mount function registered, so all tests should fail
cy.get('.failed > .num').should('contain', 2)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

honestly not sure why this ever passed initially, but I would argue this is the correct behavior since there is no mount function.

})

it('supports serving files with whitespace', () => {
const specWithWhitespace = 'spec with whitespace.cy.jsx'

cy.scaffoldProject('vite2.9.1-react')
cy.openProject('vite2.9.1-react', ['--config-file', 'cypress-vite.config.ts', '--component'])
cy.scaffoldProject('vite5.4.10-react')
cy.openProject('vite5.4.10-react', ['--config-file', 'cypress-vite.config.ts', '--component'])
cy.startAppServer('component')

cy.withCtx(async (ctx, { specWithWhitespace }) => {
Expand All @@ -76,8 +77,8 @@ describe('Config options', () => {
})

it('supports @cypress/vite-dev-server', () => {
cy.scaffoldProject('vite2.9.1-react')
cy.openProject('vite2.9.1-react', ['--config-file', 'cypress-vite-dev-server-function.config.ts', '--component'])
cy.scaffoldProject('vite5.4.10-react')
cy.openProject('vite5.4.10-react', ['--config-file', 'cypress-vite-dev-server-function.config.ts', '--component'])
cy.startAppServer('component')

cy.visitApp()
Expand All @@ -88,8 +89,8 @@ describe('Config options', () => {
})

it('supports viteConfig as an async function', () => {
cy.scaffoldProject('vite2.9.1-react')
cy.openProject('vite2.9.1-react', ['--config-file', 'cypress-vite-async-function-config.config.ts', '--component'])
cy.scaffoldProject('vite5.4.10-react')
cy.openProject('vite5.4.10-react', ['--config-file', 'cypress-vite-async-function-config.config.ts', '--component'])
cy.startAppServer('component')

cy.visitApp()
Expand Down Expand Up @@ -119,8 +120,8 @@ describe('sourcemaps', () => {
})
`

cy.scaffoldProject('vite3.0.2-react')
cy.openProject('vite3.0.2-react', ['--config-file', 'cypress-vite.config.ts', '--component'])
cy.scaffoldProject('vite5.4.10-react')
cy.openProject('vite5.4.10-react', ['--config-file', 'cypress-vite.config.ts', '--component'])
cy.startAppServer('component')

cy.withCtx(async (ctx, o) => {
Expand Down Expand Up @@ -159,9 +160,9 @@ describe('sourcemaps', () => {
cy.get('.runnable-err-file-path', { timeout: 250 }).should('contain', `${specName}:${line}:${column}`)
}

verifySourcemap('JsErrorSpec.cy.js', 7, 9)
verifySourcemap('JsErrorSpec.cy.js', 7, 8)

verifySourcemap('JsWithImportErrorSpec.cy.js', 9, 9)
verifySourcemap('JsWithImportErrorSpec.cy.js', 9, 8)

verifySourcemap('JsxErrorSpec.cy.jsx', 7, 8)

Expand Down
2 changes: 1 addition & 1 deletion packages/launchpad/cypress/e2e/config-warning.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('component testing dependency warnings', () => {
cy.get('[data-cy-testingtype="component"]').click()
cy.get('[data-cy="warning-alert"]', { timeout: 12000 }).should('exist')
.should('contain.text', 'Warning: Component Testing Mismatched Dependencies')
.should('contain.text', 'vite. Expected ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0, found 2.0.0-beta.70')
.should('contain.text', 'vite. Expected ^4.0.0 || ^5.0.0, found 3.2.11')
.should('contain.text', 'react. Expected ^16.0.0 || ^17.0.0 || ^18.0.0, found 15.6.2.')
.should('contain.text', 'react-dom. Expected ^16.0.0 || ^17.0.0 || ^18.0.0 but dependency was not found.')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('scaffolding component testing', {
await ctx.actions.file.writeFileInProject(
ctx.path.join('node_modules', 'react-dom', 'package.json'),
JSON.stringify({
'version': '17.0.0',
'version': '18.3.1',
}),
)
})
Expand All @@ -112,6 +112,11 @@ describe('scaffolding component testing', {
cy.findByTestId('dependency-react-dom').within(() => {
cy.get('[aria-label="installed"]').should('exist')
})

// now clean up the state that we mutated
cy.withCtx(async (ctx) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not a problem in CI but when rerunning this spec locally it fails due to polluted state in the project under test's dependencies

await ctx.fs.rmSync(ctx.path.join(ctx.currentProject!, 'node_modules', 'react-dom', 'package.json'))
})
})
})

Expand Down
2 changes: 1 addition & 1 deletion packages/scaffold-config/src/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const WIZARD_DEPENDENCY_VITE = {
package: 'vite',
installer: 'vite',
description: 'Vite is dev server that serves your source files over native ES modules',
minVersion: '^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0',
minVersion: '^4.0.0 || ^5.0.0',
} as const

export const WIZARD_DEPENDENCY_NUXT = {
Expand Down
22 changes: 4 additions & 18 deletions packages/scaffold-config/test/unit/detect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,8 @@ describe('detectFramework', () => {
const projectPath = await scaffoldMigrationProject('react-vite-ts-unconfigured')

fakeDepsInNodeModules(projectPath, [
{ devDependency: 'vite', version: '2.0.0' },
{ dependency: 'react', version: '17.0.0' },
])

const actual = await detectFramework(projectPath, resolvedCtFrameworks)

expect(actual.framework?.type).to.eq('react')
expect(actual.bundler).to.eq('vite')
})

it(`React with Vite using pre-release version`, async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we support installing a pre release if we support that major version, which is kind of weird because we don't know if we will be compatible with the next major version, so we shouldn't actually support this OOTB and instead let users skip the install step to try the test harness

const projectPath = await scaffoldMigrationProject('react-vite-ts-unconfigured')

fakeDepsInNodeModules(projectPath, [
{ devDependency: 'vite', version: '2.5.0-alpha.4' },
{ dependency: 'react', version: '17.0.0' },
{ devDependency: 'vite', version: '5.0.0' },
{ dependency: 'react', version: '18.0.0' },
])

const actual = await detectFramework(projectPath, resolvedCtFrameworks)
Expand All @@ -172,7 +158,7 @@ describe('detectFramework', () => {
const projectPath = await scaffoldMigrationProject('vue3-vite-ts-unconfigured')

fakeDepsInNodeModules(projectPath, [
{ devDependency: 'vite', version: '2.0.0' },
{ devDependency: 'vite', version: '5.0.0' },
{ dependency: 'vue', version: '3.0.0' },
])

Expand Down Expand Up @@ -213,7 +199,7 @@ describe('detectFramework', () => {
})
})

;['2.0.0', '3.0.0'].forEach((v) => {
;['4.0.0', '5.0.0'].forEach((v) => {
it(`Svelte and Vite v${v}`, async () => {
const projectPath = await scaffoldMigrationProject('svelte-vite-unconfigured')

Expand Down
Loading