Unverified Commit 788e6a7a authored by Jamiboy Mohammad's avatar Jamiboy Mohammad Committed by GitHub

Enable nullish config tests in deploy mode (#99397)

## Summary

Enable the nullish-config e2e suite in deploy mode by giving the `null`
and `undefined` cases separate checked-in JavaScript configs and test
instances, sharing the existing page fixture. This removes runtime file
mutation and manual server restarts while preserving the rendering and
startup/build-log assertions.

## Verification

- Both cases passed in dev and production with Turbopack and Webpack.
- Formatting and ESLint passed.
- Deploy-mode execution has not been run locally; the PR enables the
suite for deploy CI.

<!-- NEXT_JS_LLM -->
parent b1fa1213
module.exports = {
target: null,
env: null,
webpack: null,
pageExtensions: null,
}
module.exports = {
target: undefined,
env: undefined,
webpack: undefined,
pageExtensions: undefined,
}
import { nextTestSetup, isNextDev } from 'e2e-utils'
// TODO(deploy-test-completion): Re-enable this suite in deploy mode.
// It likely asserts local CLI or runtime output that deploy tests do not expose.
// @force-gate !deploy
describe('Nullish configs in next.config.js', () => {
const { next } = nextTestSetup({
files: __dirname,
skipStart: true,
})
afterEach(async () => {
await next.stop().catch(() => {})
})
it('should ignore configs set to `undefined` in next.config.js', async () => {
await next.patchFile(
'next.config.js',
`
module.exports = {
target: undefined,
env: undefined,
webpack: undefined,
pageExtensions: undefined,
import { FileRef, nextTestSetup } from 'e2e-utils'
import { join } from 'path'
describe.each(['undefined', 'null'])(
'Nullish configs set to %s in next.config.js',
(value) => {
const { next, isNextDev } = nextTestSetup({
files: {
pages: new FileRef(join(__dirname, 'pages')),
'next.config.js': new FileRef(
join(__dirname, 'configs', `${value}.js`)
),
},
})
it('should ignore nullish config values', async () => {
const html = await next.render('/')
expect(html).toContain('Hello World')
if (isNextDev) {
expect(next.cliOutput).toMatch(/ready/i)
} else {
expect(next.cliOutput).toMatch(/Compiled successfully/i)
}
`
)
await next.start()
const html = await next.render('/')
expect(html).toContain('Hello World')
if (isNextDev) {
expect(next.cliOutput).toMatch(/ready/i)
} else {
expect(next.cliOutput).toMatch(/Compiled successfully/i)
}
})
it('should ignore configs set to `null` in next.config.js', async () => {
await next.patchFile(
'next.config.js',
`
module.exports = {
target: null,
env: null,
webpack: null,
pageExtensions: null,
}
`
)
await next.start()
const html = await next.render('/')
expect(html).toContain('Hello World')
if (isNextDev) {
expect(next.cliOutput).toMatch(/ready/i)
} else {
expect(next.cliOutput).toMatch(/Compiled successfully/i)
}
})
})
})
}
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment