chore(test): add types to tests (#66724)

## Why?

Adding types to test—building on this
[PR](https://github.com/vercel/next.js/pull/65722).
This commit is contained in:
Sam Ko 2024-06-10 14:54:56 -07:00 committed by GitHub
parent edf8cc52fc
commit 78505fcb78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 12 deletions

View file

@ -10,11 +10,12 @@ import {
initNextServerScript,
killApp,
} from 'next-test-utils'
import { ChildProcess } from 'child_process'
describe('required server files app router', () => {
let next: NextInstance
let server
let appPort
let server: ChildProcess
let appPort: number | string
const setupNext = async ({
nextEnv,
@ -83,14 +84,17 @@ describe('required server files app router', () => {
/- Local:/,
{
...process.env,
PORT: appPort,
PORT: `${appPort}`,
},
undefined,
{
cwd: next.testDir,
}
)
appPort = `http://127.0.0.1:${appPort}`
if (process.platform === 'darwin') {
appPort = `http://127.0.0.1:${appPort}`
}
}
beforeAll(async () => {

View file

@ -14,11 +14,12 @@ import {
waitFor,
} from 'next-test-utils'
import nodeFetch from 'node-fetch'
import { ChildProcess } from 'child_process'
describe('required server files i18n', () => {
let next: NextInstance
let server
let appPort
let server: ChildProcess
let appPort: number | string
let errors = []
let requiredFilesManifest
@ -117,7 +118,7 @@ describe('required server files i18n', () => {
/- Local:/,
{
...process.env,
PORT: appPort,
PORT: `${appPort}`,
},
undefined,
{
@ -127,7 +128,12 @@ describe('required server files i18n', () => {
},
}
)
if (process.platform === 'darwin') {
appPort = `http://127.0.0.1:${appPort}`
}
})
afterAll(async () => {
await next.destroy()
if (server) await killApp(server)

View file

@ -101,7 +101,10 @@ describe('required server files app router', () => {
cwd: next.testDir,
}
)
appPort = `http://127.0.0.1:${appPort}`
if (process.platform === 'darwin') {
appPort = `http://127.0.0.1:${appPort}`
}
}
beforeAll(async () => {

View file

@ -15,11 +15,12 @@ import {
retry,
waitFor,
} from 'next-test-utils'
import { ChildProcess } from 'child_process'
describe('required server files', () => {
let next: NextInstance
let server
let appPort
let server: ChildProcess
let appPort: number | string
let errors = []
let stderr = ''
let requiredFilesManifest
@ -124,7 +125,7 @@ describe('required server files', () => {
{
...process.env,
ENV_FROM_HOST: 'FOOBAR',
PORT: appPort,
PORT: `${appPort}`,
},
undefined,
{
@ -1296,7 +1297,7 @@ describe('required server files', () => {
/- Local:/,
{
...process.env,
PORT: appPort,
PORT: `${appPort}`,
},
undefined,
{