Skip to content

Commit

Permalink
Fix deploy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed May 8, 2023
1 parent cc85686 commit 953c1ad
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ export default async function build(
hasAppDir = Boolean(appDir)

if (isAppDirEnabled && hasAppDir) {
if (!process.env.__NEXT_TEST_MODE && ciEnvironment.hasNextSupport) {
if (
(!process.env.__NEXT_TEST_MODE ||
process.env.__NEXT_TEST_MODE === 'e2e') &&
ciEnvironment.hasNextSupport
) {
const requireHook = require.resolve('../server/require-hook')
const contents = await promises.readFile(requireHook, 'utf8')
await promises.writeFile(
Expand Down
8 changes: 5 additions & 3 deletions test/e2e/app-dir/app-static/app-static.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,11 @@ createNextDescribe(
await waitFor(500)
}

expect(next.cliOutput.substring(buildCliOutputIndex)).not.toContain(
'rendering index'
)
if (isNextStart) {
expect(next.cliOutput.substring(buildCliOutputIndex)).not.toContain(
'rendering index'
)
}
})

it.each([
Expand Down
2 changes: 1 addition & 1 deletion test/lib/next-modes/next-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class NextDeployInstance extends NextInstance {
[
'deploy',
'--build-env',
'NEXT_PRIVATE_TEST_MODE=1',
'NEXT_PRIVATE_TEST_MODE=e2e',
'--build-env',
'NEXT_TELEMETRY_DISABLED=1',
...additionalEnv,
Expand Down
2 changes: 1 addition & 1 deletion test/lib/next-modes/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class NextDevInstance extends NextInstance {
...this.env,
NODE_ENV: '' as any,
PORT: this.forcedPort || '0',
__NEXT_TEST_MODE: '1',
__NEXT_TEST_MODE: 'e2e',
__NEXT_TEST_WITH_DEVTOOL: '1',
},
})
Expand Down
2 changes: 1 addition & 1 deletion test/lib/next-modes/next-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class NextStartInstance extends NextInstance {
...this.env,
NODE_ENV: '' as any,
PORT: this.forcedPort || '0',
__NEXT_TEST_MODE: '1',
__NEXT_TEST_MODE: 'e2e',
},
}
let buildArgs = ['yarn', 'next', 'build']
Expand Down

0 comments on commit 953c1ad

Please sign in to comment.