File size: 1,170 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
/* 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: {
'@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()
})
})
|