Files
vercel__next.js/test/development/empty-project/empty-project.test.ts
Sebastian "Sebbie" Silbermann 6ba71046b0 [test] Move the harness off node-fetch (#98195)
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.
2026-09-10 13:50:35 +02:00

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)
})
})