Skip to content

Commit

Permalink
Revert patchServerFile
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Jun 11, 2024
1 parent 96d5c9a commit 58da940
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 35 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
killApp,
} from 'next-test-utils'
import { ChildProcess } from 'child_process'
import { patchServerFile } from './patch-server-file'

describe('required server files app router', () => {
let next: NextInstance
Expand Down Expand Up @@ -71,11 +70,17 @@ describe('required server files app router', () => {
}
}

const testServerFilename = join(next.testDir, 'standalone/server.js')
await patchServerFile(testServerFilename, { minimalMode })
const testServer = join(next.testDir, 'standalone/server.js')
await fs.writeFile(
testServer,
(await fs.readFile(testServer, 'utf8')).replace(
'port:',
`minimalMode: ${minimalMode},port:`
)
)
appPort = await findPort()
server = await initNextServerScript(
testServerFilename,
testServer,
/- Local:/,
{
...process.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
} from 'next-test-utils'
import nodeFetch from 'node-fetch'
import { ChildProcess } from 'child_process'
import { patchServerFile } from './patch-server-file'

describe('required server files i18n', () => {
let next: NextInstance
Expand Down Expand Up @@ -105,11 +104,17 @@ describe('required server files i18n', () => {
}
}

const testServerFilename = join(next.testDir, 'standalone/server.js')
await patchServerFile(testServerFilename, { minimalMode: true })
const testServer = join(next.testDir, 'standalone/server.js')
await fs.writeFile(
testServer,
(await fs.readFile(testServer, 'utf8')).replace(
'port:',
'minimalMode: true,port:'
)
)
appPort = await findPort()
server = await initNextServerScript(
testServerFilename,
testServer,
/- Local:/,
{
...process.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
killApp,
} from 'next-test-utils'
import { ChildProcess } from 'child_process'
import { patchServerFile } from './patch-server-file'

describe('required server files app router', () => {
let next: NextInstance
Expand Down Expand Up @@ -81,11 +80,17 @@ describe('required server files app router', () => {
}
}

const testServerFilename = join(next.testDir, 'standalone/server.js')
await patchServerFile(testServerFilename, { minimalMode })
const testServer = join(next.testDir, 'standalone/server.js')
await fs.writeFile(
testServer,
(await fs.readFile(testServer, 'utf8')).replace(
'port:',
`minimalMode: ${minimalMode},port:`
)
)
appPort = await findPort()
server = await initNextServerScript(
testServerFilename,
testServer,
/- Local:/,
{
...process.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
waitFor,
} from 'next-test-utils'
import { ChildProcess } from 'child_process'
import { patchServerFile } from './patch-server-file'

describe('required server files', () => {
let next: NextInstance
Expand Down Expand Up @@ -116,7 +115,15 @@ describe('required server files', () => {
stderr = ''

const testServerFilename = join(next.testDir, 'standalone/server.js')
await patchServerFile(testServerFilename, { minimalMode })
const testServerContent = await fs.readFile(testServerFilename, 'utf8')

await fs.writeFile(
testServerFilename,
testServerContent.replace(
/(startServer\({\s*)(minimalMode: (true|false),\n {2})?/,
`$1minimalMode: ${minimalMode},\n `
)
)

appPort = await findPort()

Expand Down

0 comments on commit 58da940

Please sign in to comment.