Skip to content

Commit

Permalink
chore(test): add types to tests (#66724)
Browse files Browse the repository at this point in the history
## Why?

Adding types to test—building on this
[PR](#65722).
  • Loading branch information
samcx authored Jun 10, 2024
1 parent edf8cc5 commit 78505fc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -117,7 +118,7 @@ describe('required server files i18n', () => {
/- Local:/,
{
...process.env,
PORT: appPort,
PORT: `${appPort}`,
},
undefined,
{
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -124,7 +125,7 @@ describe('required server files', () => {
{
...process.env,
ENV_FROM_HOST: 'FOOBAR',
PORT: appPort,
PORT: `${appPort}`,
},
undefined,
{
Expand Down Expand Up @@ -1296,7 +1297,7 @@ describe('required server files', () => {
/- Local:/,
{
...process.env,
PORT: appPort,
PORT: `${appPort}`,
},
undefined,
{
Expand Down

0 comments on commit 78505fc

Please sign in to comment.