1
0
mirror of synced 2025-12-11 00:48:21 +08:00

fix(console): disable log collapsing for group

This commit is contained in:
redhoodsu
2019-10-01 21:24:03 +08:00
parent 68b5ecc550
commit 3b3a5ecccb
3 changed files with 15 additions and 50 deletions

View File

@@ -37,7 +37,7 @@ let coverage = reduce(
collector.add(coverage)
reporter.addAll(['html', 'lcov'])
reporter.addAll(['text', 'html', 'lcov'])
reporter.write(collector, true, function() {
console.log('open coverage/index.html to see the coverage report.')
})

View File

@@ -16,7 +16,8 @@ import {
loadJs,
$,
Stack,
isEmpty
isEmpty,
contain
} from '../lib/util'
export default class Logger extends Emitter {
@@ -272,7 +273,7 @@ export default class Logger extends Emitter {
const lastLog = this._lastLog
if (
log.type !== 'html' &&
!contain(['html', 'group', 'groupCollapsed'], log.type) &&
lastLog.type === log.type &&
lastLog.value === log.value &&
!log.src &&

View File

@@ -1,51 +1,17 @@
const handlebars = require('handlebars/runtime')
const isNum = require('licia/isNum')
// https://github.com/helpers/handlebars-helper-repeat
function repeatHelper() {
var args = arguments
handlebars.registerHelper('repeat', (count = 0, options) => {
if (count < 1) return options.inverse(this)
if (args.length > 2) {
throw new Error(`Expected 0, 1 or 2 arguments, but got ${args.length}`)
}
var options = args[args.length - 1]
var hash = options.hash || {}
var count = hash.count || args[0] || 0
var start = hash.start || 0
var step = hash.step || 1
var data = { count, start, step }
if (typeof args[0] === 'string' && !isNum(args[0]) && args[0] !== '') {
return repeat(data, args[0])
}
if (data.count > 0) {
return repeatBlock(data, this, options)
}
return options.inverse(this)
}
function repeat({ count, start, step }, thisArg) {
var max = count * step + start
var index = start
var str = ''
while (index < max) {
str += thisArg
index += step
}
return str
}
function repeatBlock({ count, start, step }, thisArg, options) {
var max = count * step + start
var index = start
var str = ''
const step = 1
const start = 0
const max = count * step + start
let index = start
let str = ''
do {
var data = {
const data = {
index,
count,
start,
@@ -53,14 +19,12 @@ function repeatBlock({ count, start, step }, thisArg, options) {
first: index === start,
last: index >= max - step
}
var blockParams = [index, data]
str += options.fn(thisArg, { data, blockParams })
const blockParams = [index, data]
str += options.fn(this, { data, blockParams })
index += data.step
} while (index < max)
return str
}
handlebars.registerHelper('repeat', repeatHelper)
})
module.exports = handlebars