ac46ffe08f
This disables tests that should not be run in a deployed environment, because they use incompatible APIs or there's no reason to test them outside of `next start`. Specifically disables for things like: - Using `next.patchFile`, `next.renameFile`, etc. - Attempting to use `next.cliOutput` to query runtime logs. When deployed, these are only build-time logs. [Latest Run](https://github.com/vercel/next.js/actions/runs/9483807368)
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('favicon-short-circuit', () => {
|
|
const { next, isNextDev } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
if (isNextDev) {
|
|
it('should short circuit the favicon in development', async () => {
|
|
const res = await next.fetch('/favicon.ico')
|
|
|
|
// Expect we got the right status and headers.
|
|
expect(res.status).toBe(404)
|
|
expect(res.headers.get('content-type')).toBeNull()
|
|
|
|
// Expect we got no body.
|
|
const text = await res.text()
|
|
expect(text).toBeEmpty()
|
|
|
|
// Expect we didn't compile the not found route.
|
|
expect(next.cliOutput).not.toContain('compiling /not-found')
|
|
})
|
|
} else {
|
|
it('should not short circuit the favicon in production', async () => {
|
|
const res = await next.fetch('/favicon.ico')
|
|
|
|
// Expect we got the right status and headers.
|
|
expect(res.status).toBe(404)
|
|
expect(res.headers.get('content-type')).toBe('text/html; charset=utf-8')
|
|
|
|
// Expect we got the right body.
|
|
const html = await res.text()
|
|
expect(html).toContain('<html>')
|
|
})
|
|
}
|
|
})
|