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