mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
disable build logs for test environments
This commit is contained in:
parent
7e91ae1d13
commit
65349b7335
@ -39,9 +39,8 @@ export default class Builder {
|
||||
this.webpackHotMiddleware = null
|
||||
this.filesWatcher = null
|
||||
this.customFilesWatcher = null
|
||||
this.spinner = createSpinner({
|
||||
minimal: this.options.minimalCLI
|
||||
})
|
||||
this.spinner = createSpinner({ minimal: this.options.minimalCLI })
|
||||
this.spinner.enabled = !this.options.test
|
||||
|
||||
// Mute stats on dev
|
||||
this.webpackStats = this.options.dev ? false : this.options.build.stats
|
||||
|
@ -38,19 +38,21 @@ export const createSpinner = function ({ minimal = false }) {
|
||||
|
||||
// Creare a minimal fallback for test and CI environments
|
||||
|
||||
const ctx = { enabled: true }
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const logger = (tag) => (...args) => console.log(
|
||||
const createLogger = (tag, ctx) => (...args) => ctx.enabled && console.log(
|
||||
`[${(new Date().toISOString)()}]`,
|
||||
_.padEnd(`[${tag}]`, 10),
|
||||
...args
|
||||
)
|
||||
|
||||
return {
|
||||
start: logger('START'),
|
||||
fail: logger('FAIL'),
|
||||
succeed: logger('SUCCESS'),
|
||||
info: logger('INFO')
|
||||
}
|
||||
return Object.assign(ctx, {
|
||||
start: createLogger('START', ctx),
|
||||
fail: createLogger('FAIL', ctx),
|
||||
succeed: createLogger('SUCCESS', ctx),
|
||||
info: createLogger('INFO', ctx)
|
||||
})
|
||||
}
|
||||
|
||||
export const encodeHtml = function encodeHtml(str) {
|
||||
|
Loading…
Reference in New Issue
Block a user