Remove redundant React dependency declarations in test (#66530)

This commit is contained in:
Sebastian Silbermann 2024-06-05 18:10:24 +02:00 committed by GitHub
parent 82fe21f0a0
commit ff366ed08d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 7 additions and 150 deletions

View file

@ -405,7 +405,8 @@ ${ENDGROUP}`)
// a starter Next.js install to re-use to speed up tests
// to avoid having to run yarn each time
console.log(`${GROUP}Creating Next.js install for isolated tests`)
const reactVersion = process.env.NEXT_TEST_REACT_VERSION || 'beta'
const reactVersion =
process.env.NEXT_TEST_REACT_VERSION || '19.0.0-rc-f994737d14-20240522'
const { installDir, pkgPaths, tmpRepoDir } = await createNextInstall({
parentSpan: mockTrace(),
dependencies: {

View file

@ -7,10 +7,6 @@ import { outdent } from 'outdent'
describe('ReactRefresh app', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -8,10 +8,6 @@ import { outdent } from 'outdent'
describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -11,8 +11,6 @@ describe.skip('ReactRefreshLogBox scss app', () => {
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
sass: 'latest',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -14,10 +14,6 @@ const IS_TURBOPACK = Boolean(process.env.TURBOPACK)
describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -8,10 +8,6 @@ import { outdent } from 'outdent'
describe.skip('ReactRefreshLogBox app', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -6,10 +6,6 @@ import { outdent } from 'outdent'
describe('ReactRefreshModule app', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -12,8 +12,6 @@ describe('ReactRefreshRegression app', () => {
'styled-components': '5.1.0',
'@next/mdx': 'canary',
'@mdx-js/loader': '0.18.0',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -7,10 +7,6 @@ import { outdent } from 'outdent'
describe('ReactRefreshRequire app', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -28,10 +28,6 @@ async function clickImportTraceFiles(browser: any) {
describe('Error overlay - editor links', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -6,10 +6,6 @@ import { outdent } from 'outdent'
describe('Error overlay - error message urls', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -8,10 +8,6 @@ import { outdent } from 'outdent'
describe.each(['default', 'turbo'])('Error recovery app %s', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -10,10 +10,6 @@ import { getRedboxTotalErrorCount } from 'next-test-utils'
describe('Error overlay for hydration errors', () => {
const { next, isTurbopack } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -8,8 +8,6 @@ describe('Error Overlay invalid imports', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'server-only': 'latest',
'client-only': 'latest',
},

View file

@ -7,10 +7,6 @@ import { outdent } from 'outdent'
describe('Error overlay - RSC build errors', () => {
const { next, isTurbopack } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'rsc-build-errors')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -8,10 +8,6 @@ import { outdent } from 'outdent'
describe('Error Overlay for server components', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -7,10 +7,6 @@ import path from 'path'
describe('Error overlay for hydration errors', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -27,10 +27,6 @@ const initialFiles = new Map([
describe('Error Overlay for server components compiler errors in pages', () => {
const { next } = nextTestSetup({
files: {},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
skipStart: true,
})

View file

@ -8,8 +8,6 @@ describe('Deprecated @next/font warning', () => {
'pages/index.js': '',
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'@next/font': 'canary',
},
skipStart: true,

View file

@ -7,8 +7,6 @@ describe('app-dir action allowed origins', () => {
files: join(__dirname, 'safe-origins'),
skipDeployment: true,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'server-only': 'latest',
},
// An arbitrary & random port.

View file

@ -7,8 +7,6 @@ describe('app-dir action disallowed origins', () => {
files: join(__dirname, 'unsafe-origins'),
skipDeployment: true,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'server-only': 'latest',
},
})

View file

@ -6,8 +6,6 @@ describe('app-dir action handling - next export', () => {
skipStart: true,
skipDeployment: true,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'server-only': 'latest',
},
})

View file

@ -5,10 +5,6 @@ import { check } from 'next-test-utils'
describe('app-dir action useActionState', () => {
const { next } = nextTestSetup({
files: __dirname,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
it('should support submitting form state with JS', async () => {
const browser = await next.browser('/client/form-state')

View file

@ -7,9 +7,7 @@ describe('app-dir action progressive enhancement', () => {
const { next } = nextTestSetup({
files: __dirname,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
nanoid: 'latest',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'server-only': 'latest',
},
})

View file

@ -11,8 +11,6 @@ describe('app-dir action size limit invalid config', () => {
skipDeployment: true,
skipStart: true,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'server-only': 'latest',
},
})

View file

@ -19,9 +19,7 @@ describe('app-dir action handling', () => {
nextTestSetup({
files: __dirname,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
nanoid: 'latest',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'server-only': 'latest',
},
})

View file

@ -6,8 +6,6 @@ describe('app dir - css with pageextensions', () => {
skipDeployment: true,
dependencies: {
'@picocss/pico': '1.5.7',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
sass: 'latest',
},
})

View file

@ -7,8 +7,6 @@ describe('app dir - css', () => {
skipDeployment: true,
dependencies: {
'@picocss/pico': '1.5.7',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
sass: 'latest',
'@next/mdx': 'canary',
},

View file

@ -4,10 +4,6 @@ import path from 'path'
describe('referencing a client component in an app route', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname)),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
it('responds without error', async () => {

View file

@ -73,10 +73,6 @@ import stripAnsi from 'strip-ansi'
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})
afterAll(() => next.destroy())
@ -127,10 +123,6 @@ import stripAnsi from 'strip-ansi'
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})
afterAll(() => next.destroy())
@ -236,10 +228,6 @@ import stripAnsi from 'strip-ansi'
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
await expect(next.start()).rejects.toThrow('next build failed')

View file

@ -9,8 +9,6 @@ describe('navigation between pages and app dir', () => {
next = await createNext({
files: new FileRef(__dirname),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',

View file

@ -4,8 +4,6 @@ describe('redirects and rewrites', () => {
const { next } = nextTestSetup({
files: __dirname,
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',

View file

@ -17,8 +17,6 @@ describe('New Link Behavior with <a> child', () => {
},
dependencies: {
next: 'latest',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})

View file

@ -24,8 +24,6 @@ describe('New Link Behavior with material-ui', () => {
'@mui/material': 'latest',
next: 'latest',
'prop-types': 'latest',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
// Use minimum peer dep version instead of v9 of eslint to avoid breaking changes
eslint: '8.56.0',
'eslint-config-next': 'latest',

View file

@ -21,8 +21,6 @@ describe('New Link Behavior with stitches', () => {
dependencies: {
'@stitches/react': '^1.2.6',
next: 'latest',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})

View file

@ -29,10 +29,6 @@ describe('next/font/google with proxy', () => {
next = await createNext({
files: new FileRef(join(__dirname, 'with-proxy')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
env: {
http_proxy: 'http://localhost:' + PROXY_PORT,
},

View file

@ -40,10 +40,6 @@ describe('beforeInteractive in document Head', () => {
}
`,
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})
afterAll(() => next.destroy())
@ -100,10 +96,6 @@ describe('beforeInteractive in document body', () => {
}
`,
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})
afterAll(() => next.destroy())
@ -161,10 +153,6 @@ describe('empty strategy in document Head', () => {
}
`,
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})
afterAll(() => next.destroy())
@ -220,10 +208,6 @@ describe('empty strategy in document body', () => {
}
`,
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})
afterAll(() => next.destroy())
@ -267,11 +251,6 @@ describe('empty strategy in document body', () => {
}
`,
},
// TODO: @housseindjirdeh: verify React 18 functionality
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})
afterAll(() => next.destroy())
@ -320,8 +299,6 @@ describe('empty strategy in document body', () => {
`,
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'@builder.io/partytown': '0.4.2',
},
})
@ -409,8 +386,6 @@ describe('empty strategy in document body', () => {
`,
},
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
'@builder.io/partytown': '0.4.2',
},
})
@ -525,8 +500,6 @@ describe('empty strategy in document body', () => {
},
dependencies: {
'@builder.io/partytown': '0.4.2',
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
})

View file

@ -43,10 +43,6 @@ describe('Switchable runtime', () => {
beforeAll(async () => {
next = await createNext({
files: new FileRef(__dirname),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
})
context = {
appPort: next.url,

View file

@ -16,8 +16,6 @@ describe('transpile packages', () => {
next = await createNext({
files: new FileRef(path.join(__dirname, './npm')),
dependencies: {
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
sass: 'latest',
},
packageJson: {

View file

@ -29,6 +29,11 @@ export function runTests(
const srcFiles = await fs.readdir(srcDir)
const packageJson = await fs.readJson(join(srcDir, 'package.json'))
// Use the default versions that are usually used in tests.
// Since we replace `next` in the install, we also need to fulfill the peerDependencies.
// However, the example specified latest next which may have different peerDependencies that the next that we test here i.e. the next on this commit.
delete packageJson.dependencies['react']
delete packageJson.dependencies['react-dom']
next = await createNext({
files: srcFiles.reduce(
@ -43,8 +48,6 @@ export function runTests(
dependencies: {
...packageJson.dependencies,
...packageJson.devDependencies,
react: '19.0.0-rc-f994737d14-20240522',
'react-dom': '19.0.0-rc-f994737d14-20240522',
},
installCommand: ({ dependencies }) => {
const pkgs = Object.keys(dependencies).reduce((prev, cur) => {