Unverified Commit 211dad31 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Adjust experimental warning (#8432)

* Adjust experimental warning
This adds some flare to the experimental warning message.

* Update test
parent 1d9fd6a5
import chalk from 'chalk'
import findUp from 'find-up' import findUp from 'find-up'
import os from 'os' import os from 'os'
...@@ -49,8 +50,14 @@ const defaultConfig: { [key: string]: any } = { ...@@ -49,8 +50,14 @@ const defaultConfig: { [key: string]: any } = {
const experimentalWarning = execOnce(() => { const experimentalWarning = execOnce(() => {
console.warn( console.warn(
`\nFound experimental config:\nExperimental features can change at anytime and aren't officially supported (use at your own risk).\n` chalk.yellow.bold('Warning: ') +
chalk.bold('You have enabled experimental feature(s).')
) )
console.warn(
`Experimental features are not covered by semver, and may cause unexpected or broken application behavior. ` +
`Use them at your own risk.`
)
console.warn()
}) })
function assignDefaults(userConfig: { [key: string]: any }) { function assignDefaults(userConfig: { [key: string]: any }) {
......
...@@ -21,7 +21,7 @@ describe('Promise in next config', () => { ...@@ -21,7 +21,7 @@ describe('Promise in next config', () => {
`) `)
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).not.toMatch(/Found experimental config:/) expect(stderr).not.toMatch(/experimental feature/)
}) })
it('should not show warning with config from object', async () => { it('should not show warning with config from object', async () => {
...@@ -31,7 +31,7 @@ describe('Promise in next config', () => { ...@@ -31,7 +31,7 @@ describe('Promise in next config', () => {
} }
`) `)
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).not.toMatch(/Found experimental config:/) expect(stderr).not.toMatch(/experimental feature/)
}) })
it('should show warning with config from object with experimental', async () => { it('should show warning with config from object with experimental', async () => {
...@@ -44,7 +44,7 @@ describe('Promise in next config', () => { ...@@ -44,7 +44,7 @@ describe('Promise in next config', () => {
} }
`) `)
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toMatch(/Found experimental config:/) expect(stderr).toMatch(/experimental feature/)
}) })
it('should show warning with config from function with experimental', async () => { it('should show warning with config from function with experimental', async () => {
...@@ -57,6 +57,6 @@ describe('Promise in next config', () => { ...@@ -57,6 +57,6 @@ describe('Promise in next config', () => {
}) })
`) `)
const { stderr } = await nextBuild(appDir, [], { stderr: true }) const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toMatch(/Found experimental config:/) expect(stderr).toMatch(/experimental feature/)
}) })
}) })
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