test: when console has been spied in test, ignore muting in progress plugin

This commit is contained in:
Clark Du 2018-03-13 10:22:30 +08:00
parent 2a931cbad6
commit 4bbc8a91f6
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9
2 changed files with 6 additions and 1 deletions

View File

@ -2,7 +2,10 @@ const ProgressBar = require('node-progress-bars')
const webpack = require('webpack')
module.exports = function ProgressPlugin({ color, pcolor, title }) {
muteConsole()
// eslint-disable-next-line no-console
if (!console.spiedInTest) {
muteConsole()
}
// https://github.com/bubkoo/ascii-progress
const bar = new ProgressBar({

View File

@ -30,6 +30,7 @@ export function release() {
}
context = null
delete console.spiedInTest // eslint-disable-line no-console
}
export async function intercept(levels, msg, cb) {
@ -39,6 +40,7 @@ export async function intercept(levels, msg, cb) {
)
}
context = {}
console.spiedInTest = true // eslint-disable-line no-console
if (cb === undefined && typeof msg === 'function') {
cb = msg