mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-12 03:38:07 +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.webpackHotMiddleware = null
|
||||||
this.filesWatcher = null
|
this.filesWatcher = null
|
||||||
this.customFilesWatcher = null
|
this.customFilesWatcher = null
|
||||||
this.spinner = createSpinner({
|
this.spinner = createSpinner({ minimal: this.options.minimalCLI })
|
||||||
minimal: this.options.minimalCLI
|
this.spinner.enabled = !this.options.test
|
||||||
})
|
|
||||||
|
|
||||||
// Mute stats on dev
|
// Mute stats on dev
|
||||||
this.webpackStats = this.options.dev ? false : this.options.build.stats
|
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
|
// Creare a minimal fallback for test and CI environments
|
||||||
|
|
||||||
|
const ctx = { enabled: true }
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
const logger = (tag) => (...args) => console.log(
|
const createLogger = (tag, ctx) => (...args) => ctx.enabled && console.log(
|
||||||
`[${(new Date().toISOString)()}]`,
|
`[${(new Date().toISOString)()}]`,
|
||||||
_.padEnd(`[${tag}]`, 10),
|
_.padEnd(`[${tag}]`, 10),
|
||||||
...args
|
...args
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return Object.assign(ctx, {
|
||||||
start: logger('START'),
|
start: createLogger('START', ctx),
|
||||||
fail: logger('FAIL'),
|
fail: createLogger('FAIL', ctx),
|
||||||
succeed: logger('SUCCESS'),
|
succeed: createLogger('SUCCESS', ctx),
|
||||||
info: logger('INFO')
|
info: createLogger('INFO', ctx)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const encodeHtml = function encodeHtml(str) {
|
export const encodeHtml = function encodeHtml(str) {
|
||||||
|
Loading…
Reference in New Issue
Block a user