e421fea1ee
<details> <summary>React upstream changes</summary> - https://github.com/facebook/react/pull/29219 - https://github.com/facebook/react/pull/29007 - https://github.com/facebook/react/pull/29207 </details>
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
/* eslint-env jest */
|
|
import { nextTestSetup } from 'e2e-utils'
|
|
import { check } from 'next-test-utils'
|
|
|
|
describe('Deprecated @next/font warning', () => {
|
|
const { next, skipped } = nextTestSetup({
|
|
files: {
|
|
'pages/index.js': '',
|
|
},
|
|
dependencies: {
|
|
react: '19.0.0-rc-f994737d14-20240522',
|
|
'react-dom': '19.0.0-rc-f994737d14-20240522',
|
|
'@next/font': 'canary',
|
|
},
|
|
skipStart: true,
|
|
})
|
|
if (skipped) return
|
|
|
|
it('should warn if @next/font is in deps', async () => {
|
|
await next.start()
|
|
await check(() => next.cliOutput, /ready/i)
|
|
await check(
|
|
() => next.cliOutput,
|
|
new RegExp('please use the built-in `next/font` instead')
|
|
)
|
|
|
|
await next.stop()
|
|
await next.clean()
|
|
})
|
|
|
|
it('should not warn if @next/font is not in deps', async () => {
|
|
// Remove @next/font from deps
|
|
const packageJson = JSON.parse(await next.readFile('package.json'))
|
|
delete packageJson.dependencies['@next/font']
|
|
await next.patchFile('package.json', JSON.stringify(packageJson))
|
|
|
|
await next.start()
|
|
await check(() => next.cliOutput, /ready/i)
|
|
expect(next.cliOutput).not.toInclude(
|
|
'please use the built-in `next/font` instead'
|
|
)
|
|
|
|
await next.stop()
|
|
await next.clean()
|
|
})
|
|
})
|