refactor: support string param in mock-log

This commit is contained in:
Clark Du 2018-04-18 23:11:06 +08:00
parent 68560c6aae
commit 0583558d77
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9

View File

@ -2,6 +2,8 @@
export default function mockLog(levels = 'all', logger = console) {
if (levels === 'all') {
levels = ['trace', 'debug', 'log', 'info', 'warn', 'error']
} else if (typeof levels === 'string') {
levels = [levels]
}
beforeAll(() => {
for (let level of levels) {