rsnext/test/e2e/config-schema-check/index.test.ts
Jiachi Liu cc4cceb4f0
Polish compiling and turbopack logging (#57270)
## Make server info log faster

Change to display the server info earlier before server handler is ready

## Make "compiling" message less laggy.

Change to log the compiling logs as previous timer which trying to skip the logging short-time compiling message makes it bit laggy, so we're removing it for now. Reduce the timer from 3s to 500ms

<img width="360" alt="image" src="https://github.com/vercel/next.js/assets/4800338/19afb2d6-ec42-4a67-b664-60f8c36b5287">


## Remove the turbopack

### Now
<img width="398" alt="image" src="https://github.com/vercel/next.js/assets/4800338/fb24d83f-66d0-4383-a42b-fdeff4fe223a">

### Before

<img width="398" alt="image" src="https://github.com/vercel/next.js/assets/4800338/59d6a6f2-32d6-41d1-a80d-12c599165e6a">
2023-10-23 19:28:36 +00:00

63 lines
1.5 KiB
TypeScript

import stripAnsi from 'strip-ansi'
import { createNextDescribe } from 'e2e-utils'
import { check } from 'next-test-utils'
createNextDescribe(
'next.config.js schema validating - defaultConfig',
{
files: {
'pages/index.js': `
export default function Page() {
return <p>hello world</p>
}
`,
'next.config.js': `
module.exports = (phase, { defaultConfig }) => {
return defaultConfig
}
`,
},
skipDeployment: true,
},
({ next }) => {
it('should validate against defaultConfig', async () => {
const output = stripAnsi(next.cliOutput)
expect(output).not.toContain('Invalid next.config.js options detected')
})
}
)
createNextDescribe(
'next.config.js schema validating - invalid config',
{
files: {
'pages/index.js': `
export default function Page() {
return <p>hello world</p>
}
`,
'next.config.js': `
module.exports = {
badKey: 'badValue'
}
`,
},
skipDeployment: true,
},
({ next, isNextStart }) => {
it('should warn the invalid next config', async () => {
await check(() => {
const output = stripAnsi(next.cliOutput)
const warningTimes = output.split('badKey').length - 1
expect(output).toContain('Invalid next.config.js options detected')
expect(output).toContain('badKey')
// for next start and next build we both display the warnings
expect(warningTimes).toBe(isNextStart ? 2 : 1)
return 'success'
}, 'success')
})
}
)