Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix port value for metadataBase #49924

Merged
merged 1 commit into from May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/next/src/server/lib/start-server.ts
Expand Up @@ -187,6 +187,7 @@ export async function startServer({
env: {
FORCE_COLOR: '1',
...((initialEnv || process.env) as typeof process.env),
PORT: port + '',
NODE_OPTIONS: getNodeOptionsWithoutInspect().trim(),
},
},
Expand Down
3 changes: 2 additions & 1 deletion test/development/basic/project-directory-rename.test.ts
Expand Up @@ -18,8 +18,9 @@ describe('Project Directory Renaming', () => {
`,
},
skipStart: true,
forcedPort: (await findPort()) + '',
})
next.forcedPort = (await findPort()) + ''

await next.start()
})
afterAll(() => next.destroy())
Expand Down
@@ -1,18 +1,21 @@
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { fetchViaHTTP } from 'next-test-utils'
import { fetchViaHTTP, findPort } from 'next-test-utils'

describe('app dir - metadata missing metadataBase', () => {
let next: NextInstance
let port: number

if ((global as any).isNextDeploy) {
return it('should skip for deploy', () => {})
}

beforeAll(async () => {
port = await findPort()
next = await createNext({
skipStart: true,
files: new FileRef(__dirname),
forcedPort: port + '',
})
})
afterAll(() => next.destroy())
Expand All @@ -23,7 +26,7 @@ describe('app dir - metadata missing metadataBase', () => {
expect(next.cliOutput).toInclude(
'metadata.metadataBase is not set for resolving social open graph or twitter images, fallbacks to'
)
expect(next.cliOutput).toInclude('"http://localhost:')
expect(next.cliOutput).toInclude(`"http://localhost:${port}`)
expect(next.cliOutput).toInclude(
'. See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase'
)
Expand Down
1 change: 1 addition & 0 deletions test/lib/next-modes/base.ts
Expand Up @@ -32,6 +32,7 @@ export interface NextInstanceOpts {
env?: Record<string, string>
dirSuffix?: string
turbo?: boolean
forcedPort?: string
}

/**
Expand Down