Skip to content
Permalink
Browse files
simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used.
  • Loading branch information
sokra committed Nov 16, 2021
1 parent 9375485 commit b79591cdaf78e4bdebaa714d55e745419ad5d079
@@ -110,7 +110,7 @@ function runNextCommandDev(argv, opts = {}) {
function handleStdout(data) {
const message = data.toString()
const bootupMarkers = {
dev: /compiled successfully/i,
dev: /compiled .*successfully/i,
start: /started server/i,
}
if (
@@ -139,12 +139,8 @@ buildStore.subscribe((state) => {
loading: false,
typeChecking: false,
partial:
clientWasLoading && !serverWasLoading && !serverWebWasLoading
? 'client'
: serverWasLoading && !clientWasLoading && !serverWebWasLoading
? 'server'
: serverWebWasLoading && !clientWasLoading && !serverWasLoading
? 'serverWeb'
clientWasLoading && (serverWasLoading || serverWebWasLoading)
? 'client and server'
: undefined,
modules:
(clientWasLoading ? client.modules : 0) +
@@ -15,7 +15,7 @@ export type OutputState =
| {
loading: false
typeChecking: boolean
partial: 'client' | 'server' | 'serverWeb' | undefined
partial: 'client and server' | undefined
modules: number
errors: string[] | null
warnings: string[] | null
@@ -259,13 +259,9 @@ export default function onDemandEntryHandler(

if (entriesChanged) {
reportTrigger(
isApiRoute
? `${normalizedPage} (server only)`
: isMiddleware
? `${normalizedPage} (middleware only)`
: clientOnly
? `${normalizedPage} (client only)`
: normalizedPage
isApiRoute || isMiddleware || clientOnly
? normalizedPage
: `${normalizedPage} (client and server)`
)
invalidator.invalidate()
}
@@ -57,9 +57,11 @@ describe('basic HMR', () => {

expect(next.cliOutput.slice(start)).toContain('compiling...')
expect(next.cliOutput.slice(start)).toContain(
'compiling /hmr/contact...'
'compiling /hmr/contact (client and server)...'
)
expect(next.cliOutput).toContain(
'compiling /_error (client and server)...'
)
expect(next.cliOutput).toContain('compiling /_error...')
} finally {
if (browser) {
await browser.close()
@@ -327,9 +329,11 @@ describe('basic HMR', () => {
)

expect(next.cliOutput.slice(start)).toContain(
'compiling /hmr/new-page...'
'compiling /hmr/new-page (client and server)...'
)
expect(next.cliOutput).toContain(
'compiling /_error (client and server)...'
)
expect(next.cliOutput).toContain('compiling /_error...')
} catch (err) {
await next.deleteFile(newPage)
throw err
@@ -358,9 +362,11 @@ describe('basic HMR', () => {

await check(() => getBrowserBodyText(browser), /This is the about page/)
expect(next.cliOutput.slice(start)).toContain(
'compiling /hmr/about2...'
'compiling /hmr/about2 (client and server)...'
)
expect(next.cliOutput).toContain(
'compiling /_error (client and server)...'
)
expect(next.cliOutput).toContain('compiling /_error...')
} catch (err) {
await next.patchFile(aboutPage, aboutContent)
if (browser) {
@@ -519,7 +519,7 @@ describe('AMP Usage', () => {
})

it('should not contain missing files warning', async () => {
expect(output).toContain('compiled successfully')
expect(output).toContain('compiled client and server successfully')
expect(output).toContain('compiling /only-amp')
expect(output).not.toContain('Could not find files for')
})
@@ -1,7 +1,7 @@
/* eslint-env jest */
import fs from 'fs-extra'
import { join } from 'path'
import { launchApp, findPort, nextBuild } from 'next-test-utils'
import { launchApp, findPort, nextBuild, killApp } from 'next-test-utils'

const appDir = join(__dirname, '..')
const nextConfig = join(appDir, 'next.config.js')
@@ -27,7 +27,7 @@ const runTests = () => {

const stdout = await getStdout()

expect(stdout).toContain('ompiled successfully')
expect(stdout).toMatch(/compiled .*successfully/i)
})

it('should ignore configs set to `null` in next.config.js', async () => {
@@ -48,7 +48,7 @@ const runTests = () => {

const stdout = await getStdout()

expect(stdout).toContain('ompiled successfully')
expect(stdout).toMatch(/compiled .*successfully/i)
})
}

@@ -59,11 +59,12 @@ describe('Nullish configs in next.config.js', () => {
beforeAll(() => {
getStdout = async () => {
let stdout = ''
await launchApp(appDir, await findPort(), {
const app = await launchApp(appDir, await findPort(), {
onStdout: (msg) => {
stdout += msg
},
})
await killApp(app)
return stdout
}
})
@@ -240,7 +240,7 @@ export function runNextCommandDev(argv, stdOut, opts = {}) {
function handleStdout(data) {
const message = data.toString()
const bootupMarkers = {
dev: /compiled successfully/i,
dev: /compiled .*successfully/i,
start: /started server/i,
}
if (

0 comments on commit b79591c

Please sign in to comment.