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' import { FileRef, nextTestSetup } from 'e2e-utils'
import { join } from 'path'
// 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. describe.each(['undefined', 'null'])(
// @force-gate !deploy 'Nullish configs set to %s in next.config.js',
describe('Nullish configs in next.config.js', () => { (value) => {
const { next } = nextTestSetup({ const { next, isNextDev } = nextTestSetup({
files: __dirname, files: {
skipStart: true, pages: new FileRef(join(__dirname, 'pages')),
}) 'next.config.js': new FileRef(
join(__dirname, 'configs', `${value}.js`)
afterEach(async () => { ),
await next.stop().catch(() => {}) },
}) })
it('should ignore configs set to `undefined` in next.config.js', async () => { it('should ignore nullish config values', async () => {
await next.patchFile( const html = await next.render('/')
'next.config.js', expect(html).toContain('Hello World')
`
module.exports = { if (isNextDev) {
target: undefined, expect(next.cliOutput).toMatch(/ready/i)
env: undefined, } else {
webpack: undefined, expect(next.cliOutput).toMatch(/Compiled successfully/i)
pageExtensions: undefined,
} }
` })
) }
)
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