Unverified Commit f0ea8842 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Refine logging message of experiments (#61337)

Refining the message that uses "use with caution" instead of "use at
your own risk" as some experimental features was functionally stable but
we can't bring them as default for now and need to test as experiments

Closes NEXT-2286
parent 1862b8a0
......@@ -312,7 +312,7 @@ const nextDev: CliCommand = async (args) => {
try {
if (!!args['--experimental-https']) {
Log.warn(
'Self-signed certificates are currently an experimental feature, use at your own risk.'
'Self-signed certificates are currently an experimental feature, use with caution.'
)
let certificate: SelfSignedCertificate | undefined
......
......@@ -38,7 +38,7 @@ export function logStartInfo({
if (envInfo?.length) Log.bootstrap(` - Environments: ${envInfo.join(', ')}`)
if (expFeatureInfo?.length) {
Log.bootstrap(` - Experiments (use at your own risk):`)
Log.bootstrap(` - Experiments (use with caution):`)
// only show maximum 3 flags
for (const exp of expFeatureInfo.slice(0, maxExperimentalFeatures)) {
Log.bootstrap(` · ${exp}`)
......
......@@ -214,9 +214,8 @@ createNextDescribe(
it('should not have duplicate config warnings', async () => {
await next.fetch('/')
expect(
stripAnsi(next.cliOutput).match(
/Experiments \(use at your own risk\):/g
).length
stripAnsi(next.cliOutput).match(/Experiments \(use with caution\):/g)
.length
).toBe(1)
})
}
......
......@@ -9,7 +9,7 @@ createNextDescribe(
({ next, isNextDev, isNextStart }) => {
it('should indicate the feature is experimental', async () => {
await check(() => {
return next.cliOutput.includes('Experiments (use at your own risk)') &&
return next.cliOutput.includes('Experiments (use with caution)') &&
next.cliOutput.includes('ppr')
? 'success'
: 'fail'
......
......@@ -16,6 +16,8 @@ const appDir = join(__dirname, '..')
const configFile = new File(join(appDir, '/next.config.js'))
const configFileMjs = new File(join(appDir, '/next.config.mjs'))
const experimentalHeader = ' - Experiments (use with caution):'
let app
async function collectStdoutFromDev(appDir) {
let stdout = ''
......@@ -57,7 +59,7 @@ describe('Config Experimental Warning', () => {
`)
const stdout = await collectStdoutFromDev(appDir)
expect(stdout).not.toMatch(' - Experiments (use at your own risk):')
expect(stdout).not.toMatch(experimentalHeader)
})
it('should not show warning with config from object', async () => {
......@@ -68,7 +70,7 @@ describe('Config Experimental Warning', () => {
`)
const stdout = await collectStdoutFromDev(appDir)
expect(stdout).not.toMatch(' - Experiments (use at your own risk):')
expect(stdout).not.toMatch(experimentalHeader)
})
it('should show warning with config from object with experimental', async () => {
......@@ -81,7 +83,7 @@ describe('Config Experimental Warning', () => {
`)
const stdout = await collectStdoutFromDev(appDir)
expect(stdout).toMatch(' - Experiments (use at your own risk):')
expect(stdout).toMatch(experimentalHeader)
expect(stdout).toMatch(' · workerThreads')
})
......@@ -95,7 +97,7 @@ describe('Config Experimental Warning', () => {
`)
const stdout = await collectStdoutFromDev(appDir)
expect(stdout).toMatch(' - Experiments (use at your own risk):')
expect(stdout).toMatch(experimentalHeader)
expect(stdout).toMatch(' · workerThreads')
})
......@@ -109,7 +111,7 @@ describe('Config Experimental Warning', () => {
`)
const stdout = await collectStdoutFromDev(appDir)
expect(stdout).not.toContain(' - Experiments (use at your own risk):')
expect(stdout).not.toContain(experimentalHeader)
expect(stdout).not.toContain(' · workerThreads')
})
......@@ -124,7 +126,7 @@ describe('Config Experimental Warning', () => {
`)
const stdout = await collectStdoutFromDev(appDir)
expect(stdout).toContain(' - Experiments (use at your own risk):')
expect(stdout).toContain(experimentalHeader)
expect(stdout).toContain(' · workerThreads')
expect(stdout).toContain(' · scrollRestoration')
})
......@@ -149,7 +151,7 @@ describe('Config Experimental Warning', () => {
stdout += msg
},
})
expect(stdout).not.toMatch(' - Experiments (use at your own risk):')
expect(stdout).not.toMatch(experimentalHeader)
})
it('should show next app info with all experimental features in next build', async () => {
......@@ -164,7 +166,7 @@ describe('Config Experimental Warning', () => {
}
`)
const stdout = await collectStdoutFromBuild(appDir)
expect(stdout).toMatch(' - Experiments (use at your own risk):')
expect(stdout).toMatch(experimentalHeader)
expect(stdout).toMatch(' · cpus')
expect(stdout).toMatch(' · workerThreads')
expect(stdout).toMatch(' · scrollRestoration')
......@@ -196,9 +198,7 @@ describe('Config Experimental Warning', () => {
await check(() => {
const cliOutput = stripAnsi(stdout)
const cliOutputErr = stripAnsi(stderr)
expect(cliOutput).not.toContain(
' - Experiments (use at your own risk):'
)
expect(cliOutput).not.toContain(experimentalHeader)
expect(cliOutputErr).toContain(
`Unrecognized key(s) in object: 'appDir' at "experimental"`
)
......
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