first commit
Some checks failed
Test examples / Test Examples (20) (push) Has been cancelled
Test examples / Test Examples (22) (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Trigger Release / start (push) Has been cancelled
Stale issue handler / stale (push) Has been cancelled
Update Font Data / create-pull-request (push) Has been cancelled
build-and-deploy / deploy-target (push) Has been cancelled
build-and-deploy / build (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / build-wasm (nodejs) (push) Has been cancelled
build-and-deploy / build-wasm (web) (push) Has been cancelled
build-and-deploy / Deploy preview tarball (push) Has been cancelled
build-and-deploy / Potentially publish release (push) Has been cancelled
build-and-deploy / publish-turbopack-npm-packages (push) Has been cancelled
build-and-deploy / Deploy examples (push) Has been cancelled
build-and-deploy / thank you, build (push) Has been cancelled
build-and-deploy / Upload Turbopack Bytesize metrics to Datadog (push) Has been cancelled
Rspack Next.js development integration tests / Rspack integration tests (push) Has been cancelled
Rspack Next.js production integration tests / Rspack integration tests (push) Has been cancelled
Turbopack Next.js development integration tests / Next.js integration tests (push) Has been cancelled
Turbopack Next.js production integration tests / Next.js integration tests (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack development test manifest (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack production test manifest (push) Has been cancelled
Upload bundler test manifests to areweturboyet.com / Upload test results (push) Has been cancelled
Update React / create-pull-request (push) Has been cancelled
test-e2e-project-reset-cron / reset-test-project (push) Has been cancelled
Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days / run (push) Has been cancelled

This commit is contained in:
Arian Tron
2026-03-10 19:37:31 +03:30
commit 61f56f997c
27684 changed files with 2784175 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import { useState, useEffect } from 'react'
import unfetchImp from 'unfetch'
import isomorphicUnfetchImp from 'isomorphic-unfetch'
const testWhatwgFetchMethods = (whatWgFetch) => {
return (
whatWgFetch.Headers.name === 'Headers' &&
whatWgFetch.Request.name === 'Request' &&
whatWgFetch.Response.name === 'Response'
)
}
const testFetchImports = async () => {
const whatwgFetchImp = await import('whatwg-fetch')
const whatwgFetchReq = require('whatwg-fetch')
const unfetchReq = require('unfetch')
const isomorphicUnfetchReq = require('isomorphic-unfetch')
let areImportsMatching =
[whatwgFetchImp.fetch, whatwgFetchReq.fetch].every(
(lib) => lib.name === 'fetch'
) &&
[unfetchImp, unfetchReq, isomorphicUnfetchImp, isomorphicUnfetchReq].every(
(lib) => lib.name === 'bound fetch'
)
return areImportsMatching &&
testWhatwgFetchMethods(whatwgFetchReq) &&
testWhatwgFetchMethods(whatwgFetchImp)
? 'pass'
: 'fail'
}
const Page = () => {
const [testStatus, setTestStatus] = useState('computing')
useEffect(() => {
testFetchImports().then((status) => {
console.log(status)
setTestStatus(status)
})
}, [])
return <div id="test-status">{testStatus}</div>
}
export default Page

View File

@@ -0,0 +1,7 @@
import Link from 'next/link'
export default () => (
<div>
<Link href="/fetch">Fetch</Link>
</div>
)

View File

@@ -0,0 +1,7 @@
export default function Page() {
return (
<div id="process">
Hello, {process.env.NEXT_PUBLIC_VISITOR ?? 'stranger'}
</div>
)
}

View File

@@ -0,0 +1,59 @@
/* eslint-env jest */
import { join } from 'path'
import { nextBuild, findPort, nextStart, killApp } from 'next-test-utils'
import webdriver from 'next-webdriver'
const appDir = join(__dirname, '../')
let appPort
let app
describe('Polyfills', () => {
;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode',
() => {
let output = ''
beforeAll(async () => {
const { stdout, stderr } = await nextBuild(appDir, [], {
stdout: true,
stderr: true,
})
output = (stderr || '') + (stdout + '')
console.log(stdout)
console.error(stderr)
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})
it('should alias fetch', async () => {
const browser = await webdriver(appPort, '/fetch')
const text = await browser.elementByCss('#test-status').text()
expect(text).toBe('pass')
await browser.close()
})
it('should allow using process.env when there is an element with `id` of `process`', async () => {
const browser = await webdriver(appPort, '/process')
const text = await browser.elementByCss('#process').text()
expect(text).toBe('Hello, stranger')
await browser.close()
})
it('should contain generated page count in output', async () => {
expect(output).toMatch(/Generating static pages.*\(0\/5\)/g)
expect(output).toMatch(/Generating static pages.*\(5\/5\)/g)
// we should only have 1 segment and the initial message logged out
expect(output.match(/Generating static pages/g).length).toBe(5)
})
}
)
})