mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-24 09:29:35 -05:00
fix: Require react-dom as a dependency for React projects (#22572)
* fix: Require react-dom as a dependency for React projects * fix: Update tests * fix: Add react-dom as required dependency for Nextjs projects Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ describe('packagesToInstall', () => {
|
||||
|
||||
const actual = ctx.wizard.installDependenciesCommand()
|
||||
|
||||
expect(actual).to.eq(`npm install -D react-scripts webpack react`)
|
||||
expect(actual).to.eq(`npm install -D react-scripts webpack react-dom react`)
|
||||
})
|
||||
|
||||
it('vueclivue2-unconfigured', async () => {
|
||||
@@ -91,7 +91,7 @@ describe('packagesToInstall', () => {
|
||||
|
||||
const actual = ctx.wizard.installDependenciesCommand()
|
||||
|
||||
expect(actual).to.eq(`npm install -D vite react`)
|
||||
expect(actual).to.eq(`npm install -D vite react react-dom`)
|
||||
})
|
||||
|
||||
it('regular vue project with vite', async () => {
|
||||
@@ -123,7 +123,7 @@ describe('packagesToInstall', () => {
|
||||
|
||||
const actual = ctx.wizard.installDependenciesCommand()
|
||||
|
||||
expect(actual).to.eq(`npm install -D next react`)
|
||||
expect(actual).to.eq(`npm install -D next react react-dom`)
|
||||
})
|
||||
|
||||
it('nuxtjs-vue2-unconfigured', async () => {
|
||||
|
||||
@@ -34,6 +34,15 @@ export const WIZARD_DEPENDENCY_REACT = {
|
||||
minVersion: '>=16.x',
|
||||
} as const
|
||||
|
||||
export const WIZARD_DEPENDENCY_REACT_DOM = {
|
||||
type: 'react-dom',
|
||||
name: 'React DOM',
|
||||
package: 'react-dom',
|
||||
installer: 'react-dom',
|
||||
description: 'This package serves as the entry point to the DOM and server renderers for React',
|
||||
minVersion: '>=16.x',
|
||||
} as const
|
||||
|
||||
export const WIZARD_DEPENDENCY_TYPESCRIPT = {
|
||||
type: 'typescript',
|
||||
name: 'TypeScript',
|
||||
@@ -97,6 +106,7 @@ export const WIZARD_DEPENDENCIES = [
|
||||
WIZARD_DEPENDENCY_NUXT,
|
||||
WIZARD_DEPENDENCY_NEXT,
|
||||
WIZARD_DEPENDENCY_REACT,
|
||||
WIZARD_DEPENDENCY_REACT_DOM,
|
||||
WIZARD_DEPENDENCY_VUE_2,
|
||||
WIZARD_DEPENDENCY_VUE_3,
|
||||
] as const
|
||||
|
||||
@@ -71,6 +71,7 @@ export const WIZARD_FRAMEWORKS = [
|
||||
return [
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_REACT_SCRIPTS, projectPath),
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_WEBPACK, projectPath),
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_REACT_DOM, projectPath),
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_REACT, projectPath),
|
||||
]
|
||||
},
|
||||
@@ -128,6 +129,7 @@ export const WIZARD_FRAMEWORKS = [
|
||||
return [
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_NEXT, projectPath),
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_REACT, projectPath),
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_REACT_DOM, projectPath),
|
||||
]
|
||||
},
|
||||
codeGenFramework: 'react',
|
||||
@@ -207,6 +209,7 @@ export const WIZARD_FRAMEWORKS = [
|
||||
return [
|
||||
getBundlerDependency(bundler, projectPath),
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_REACT, projectPath),
|
||||
inPkgJson(dependencies.WIZARD_DEPENDENCY_REACT_DOM, projectPath),
|
||||
]
|
||||
},
|
||||
codeGenFramework: 'react',
|
||||
|
||||
Reference in New Issue
Block a user