mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
6ba71046b0
Node.js ships with a built-in `fetch` now so `node-fetch` is no longer necessary. Mostly motivated by tracing Node.js deprecation warnings which originated from `node-fetch` by calling the deprecated `url.parse`. Call sites keep working through a compatibility type on `fetchViaHTTP` that translates node-fetch-only options: Instead of `agent` we pass to `http(s)` directly, `timeout` becomes `AbortSignal.timeout`, and Node.js readable streams are accepted as bodies with `duplex: 'half'` set automatically. The `abort-controller` polyfill is dropped since its signal type predates the current AbortSignal and undici would not honor it. `node-fetch` stays installed because `scripts/generate-release-log.mjs`, `scripts/reset-project.mjs`, and `scripts/update-google-fonts.js` still import it (follow-up material). Fixture apps will be migrated separately.
19 lines
437 B
TypeScript
19 lines
437 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('Empty Project', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
skipStart: true,
|
|
})
|
|
|
|
beforeAll(async () => {
|
|
await next.deleteFile('pages/.gitkeep')
|
|
await next.start()
|
|
})
|
|
|
|
it('Should not time out and return 404', async () => {
|
|
const res = await next.fetch('/', { signal: AbortSignal.timeout(10_000) })
|
|
expect(res.status).toBe(404)
|
|
})
|
|
})
|