Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
162
node_modules/karma/lib/reporters/base.js
generated
vendored
Normal file
162
node_modules/karma/lib/reporters/base.js
generated
vendored
Normal file
|
@ -0,0 +1,162 @@
|
|||
'use strict'
|
||||
|
||||
const util = require('util')
|
||||
|
||||
const constants = require('../constants')
|
||||
const helper = require('../helper')
|
||||
|
||||
const BaseReporter = function (formatError, reportSlow, useColors, browserConsoleLogOptions, adapter) {
|
||||
this.adapters = [adapter || process.stdout.write.bind(process.stdout)]
|
||||
|
||||
this.USE_COLORS = false
|
||||
this.EXCLUSIVELY_USE_COLORS = undefined
|
||||
this.LOG_SINGLE_BROWSER = '%s: %s\n'
|
||||
this.LOG_MULTI_BROWSER = '%s %s: %s\n'
|
||||
|
||||
this.SPEC_FAILURE = '%s %s FAILED' + '\n'
|
||||
this.SPEC_SLOW = '%s SLOW %s: %s\n'
|
||||
this.ERROR = '%s ERROR\n'
|
||||
|
||||
this.FINISHED_ERROR = ' ERROR'
|
||||
this.FINISHED_SUCCESS = ' SUCCESS'
|
||||
this.FINISHED_DISCONNECTED = ' DISCONNECTED'
|
||||
|
||||
this.X_FAILED = ' (%d FAILED)'
|
||||
|
||||
this.TOTAL_SUCCESS = 'TOTAL: %d SUCCESS\n'
|
||||
this.TOTAL_FAILED = 'TOTAL: %d FAILED, %d SUCCESS\n'
|
||||
|
||||
this.onRunStart = () => {
|
||||
this._browsers = []
|
||||
}
|
||||
|
||||
this.onBrowserStart = (browser) => {
|
||||
this._browsers.push(browser)
|
||||
}
|
||||
|
||||
this.renderBrowser = (browser) => {
|
||||
const results = browser.lastResult
|
||||
const totalExecuted = results.success + results.failed
|
||||
let msg = `${browser}: Executed ${totalExecuted} of ${results.total}`
|
||||
|
||||
if (results.failed) {
|
||||
msg += util.format(this.X_FAILED, results.failed)
|
||||
}
|
||||
|
||||
if (results.skipped) {
|
||||
msg += ` (skipped ${results.skipped})`
|
||||
}
|
||||
|
||||
if (browser.isConnected) {
|
||||
if (results.disconnected) {
|
||||
msg += this.FINISHED_DISCONNECTED
|
||||
} else if (results.error) {
|
||||
msg += this.FINISHED_ERROR
|
||||
} else if (!results.failed) {
|
||||
msg += this.FINISHED_SUCCESS
|
||||
}
|
||||
|
||||
msg += ` (${helper.formatTimeInterval(results.totalTime)} / ${helper.formatTimeInterval(results.netTime)})`
|
||||
}
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
this.write = function () {
|
||||
const msg = util.format.apply(null, Array.prototype.slice.call(arguments))
|
||||
this.adapters.forEach((adapter) => {
|
||||
if (!helper.isDefined(adapter.colors)) {
|
||||
adapter.colors = useColors
|
||||
}
|
||||
if (!helper.isDefined(this.EXCLUSIVELY_USE_COLORS) || adapter.colors === this.EXCLUSIVELY_USE_COLORS) {
|
||||
return adapter(msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.writeCommonMsg = function () {
|
||||
this.write.apply(this, arguments)
|
||||
}
|
||||
|
||||
this.onBrowserError = (browser, error) => {
|
||||
this.writeCommonMsg(util.format(this.ERROR, browser) + formatError(error, ' '))
|
||||
}
|
||||
|
||||
this.onBrowserLog = (browser, log, type) => {
|
||||
if (!browserConsoleLogOptions || !browserConsoleLogOptions.terminal) return
|
||||
type = type.toUpperCase()
|
||||
if (browserConsoleLogOptions.level) {
|
||||
const logPriority = constants.LOG_PRIORITIES.indexOf(browserConsoleLogOptions.level.toUpperCase())
|
||||
if (constants.LOG_PRIORITIES.indexOf(type) > logPriority) return
|
||||
}
|
||||
if (!helper.isString(log)) {
|
||||
// TODO(vojta): change util to new syntax (config object)
|
||||
log = util.inspect(log, false, undefined, this.USE_COLORS)
|
||||
}
|
||||
if (this._browsers && this._browsers.length === 1) {
|
||||
this.writeCommonMsg(util.format(this.LOG_SINGLE_BROWSER, type, log))
|
||||
} else {
|
||||
this.writeCommonMsg(util.format(this.LOG_MULTI_BROWSER, browser, type, log))
|
||||
}
|
||||
}
|
||||
|
||||
this.onSpecComplete = (browser, result) => {
|
||||
if (result.skipped) {
|
||||
this.specSkipped(browser, result)
|
||||
} else if (result.success) {
|
||||
this.specSuccess(browser, result)
|
||||
} else {
|
||||
this.specFailure(browser, result)
|
||||
}
|
||||
|
||||
if (reportSlow && result.time > reportSlow) {
|
||||
const specName = result.suite.join(' ') + ' ' + result.description
|
||||
const time = helper.formatTimeInterval(result.time)
|
||||
|
||||
this.writeCommonMsg(util.format(this.SPEC_SLOW, browser, time, specName))
|
||||
}
|
||||
}
|
||||
|
||||
this.specSuccess = () => {
|
||||
}
|
||||
|
||||
this.specSkipped = () => {
|
||||
}
|
||||
|
||||
this.specFailure = (browser, result) => {
|
||||
const specName = result.suite.join(' ') + ' ' + result.description
|
||||
let msg = util.format(this.SPEC_FAILURE, browser, specName)
|
||||
|
||||
result.log.forEach((log) => {
|
||||
msg += formatError(log, '\t')
|
||||
})
|
||||
|
||||
this.writeCommonMsg(msg)
|
||||
}
|
||||
|
||||
this.onRunComplete = (browsers, results) => {
|
||||
if (browsers.length >= 1 && !results.error && !results.disconnected) {
|
||||
if (!results.failed) {
|
||||
this.write(this.TOTAL_SUCCESS, results.success)
|
||||
} else {
|
||||
this.write(this.TOTAL_FAILED, results.failed, results.success)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BaseReporter.decoratorFactory = function (formatError, reportSlow, useColors, browserConsoleLogOptions) {
|
||||
return function (self) {
|
||||
BaseReporter.call(self, formatError, reportSlow, useColors, browserConsoleLogOptions)
|
||||
}
|
||||
}
|
||||
|
||||
BaseReporter.decoratorFactory.$inject = [
|
||||
'formatError',
|
||||
'config.reportSlowerThan',
|
||||
'config.colors',
|
||||
'config.browserConsoleLogOptions'
|
||||
]
|
||||
|
||||
// PUBLISH
|
||||
module.exports = BaseReporter
|
24
node_modules/karma/lib/reporters/base_color.js
generated
vendored
Normal file
24
node_modules/karma/lib/reporters/base_color.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
const { red, yellow, green, cyan } = require('@colors/colors/safe')
|
||||
|
||||
function BaseColorReporter () {
|
||||
this.USE_COLORS = true
|
||||
|
||||
this.LOG_SINGLE_BROWSER = '%s: ' + cyan('%s') + '\n'
|
||||
this.LOG_MULTI_BROWSER = '%s %s: ' + cyan('%s') + '\n'
|
||||
|
||||
this.SPEC_FAILURE = red('%s %s FAILED') + '\n'
|
||||
this.SPEC_SLOW = yellow('%s SLOW %s: %s') + '\n'
|
||||
this.ERROR = red('%s ERROR') + '\n'
|
||||
|
||||
this.FINISHED_ERROR = red(' ERROR')
|
||||
this.FINISHED_SUCCESS = green(' SUCCESS')
|
||||
this.FINISHED_DISCONNECTED = red(' DISCONNECTED')
|
||||
|
||||
this.X_FAILED = red(' (%d FAILED)')
|
||||
|
||||
this.TOTAL_SUCCESS = green('TOTAL: %d SUCCESS') + '\n'
|
||||
this.TOTAL_FAILED = red('TOTAL: %d FAILED, %d SUCCESS') + '\n'
|
||||
}
|
||||
|
||||
// PUBLISH
|
||||
module.exports = BaseColorReporter
|
47
node_modules/karma/lib/reporters/dots.js
generated
vendored
Normal file
47
node_modules/karma/lib/reporters/dots.js
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
const BaseReporter = require('./base')
|
||||
|
||||
function DotsReporter (formatError, reportSlow, useColors, browserConsoleLogOptions) {
|
||||
BaseReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
|
||||
|
||||
const DOTS_WRAP = 80
|
||||
this.EXCLUSIVELY_USE_COLORS = false
|
||||
this.onRunStart = function () {
|
||||
this._browsers = []
|
||||
this._dotsCount = 0
|
||||
}
|
||||
|
||||
this.onBrowserStart = function (browser) {
|
||||
this._browsers.push(browser)
|
||||
}
|
||||
|
||||
this.writeCommonMsg = function (msg) {
|
||||
if (this._dotsCount) {
|
||||
this._dotsCount = 0
|
||||
msg = '\n' + msg
|
||||
}
|
||||
|
||||
this.write(msg)
|
||||
}
|
||||
|
||||
this.specSuccess = function () {
|
||||
this._dotsCount = (this._dotsCount + 1) % DOTS_WRAP
|
||||
this.write(this._dotsCount ? '.' : '.\n')
|
||||
}
|
||||
|
||||
this.onBrowserComplete = function (browser) {
|
||||
this.writeCommonMsg(this.renderBrowser(browser) + '\n')
|
||||
}
|
||||
|
||||
this.onRunComplete = function (browsers, results) {
|
||||
if (browsers.length > 1 && !results.disconnected && !results.error) {
|
||||
if (!results.failed) {
|
||||
this.write(this.TOTAL_SUCCESS, results.success)
|
||||
} else {
|
||||
this.write(this.TOTAL_FAILED, results.failed, results.success)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PUBLISH
|
||||
module.exports = DotsReporter
|
11
node_modules/karma/lib/reporters/dots_color.js
generated
vendored
Normal file
11
node_modules/karma/lib/reporters/dots_color.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
const DotsReporter = require('./dots')
|
||||
const BaseColorReporter = require('./base_color')
|
||||
|
||||
function DotsColorReporter (formatError, reportSlow, useColors, browserConsoleLogOptions) {
|
||||
DotsReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
|
||||
BaseColorReporter.call(this)
|
||||
this.EXCLUSIVELY_USE_COLORS = true
|
||||
}
|
||||
|
||||
// PUBLISH
|
||||
module.exports = DotsColorReporter
|
19
node_modules/karma/lib/reporters/multi.js
generated
vendored
Normal file
19
node_modules/karma/lib/reporters/multi.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
'use strict'
|
||||
|
||||
const helper = require('../helper')
|
||||
|
||||
class MultiReporter {
|
||||
constructor (reporters) {
|
||||
this._reporters = reporters
|
||||
}
|
||||
|
||||
addAdapter (adapter) {
|
||||
this._reporters.forEach((reporter) => reporter.adapters.push(adapter))
|
||||
}
|
||||
|
||||
removeAdapter (adapter) {
|
||||
this._reporters.forEach((reporter) => helper.arrayRemove(reporter.adapters, adapter))
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MultiReporter
|
63
node_modules/karma/lib/reporters/progress.js
generated
vendored
Normal file
63
node_modules/karma/lib/reporters/progress.js
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
const BaseReporter = require('./base')
|
||||
|
||||
function ProgressReporter (formatError, reportSlow, useColors, browserConsoleLogOptions) {
|
||||
BaseReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
|
||||
|
||||
this.EXCLUSIVELY_USE_COLORS = false
|
||||
this._browsers = []
|
||||
|
||||
this.writeCommonMsg = function (msg) {
|
||||
this.write(this._remove() + msg + this._render())
|
||||
}
|
||||
|
||||
this.specSuccess = function () {
|
||||
this.write(this._refresh())
|
||||
}
|
||||
|
||||
this.onBrowserComplete = function () {
|
||||
this.write(this._refresh())
|
||||
}
|
||||
|
||||
this.onRunStart = function () {
|
||||
this._browsers = []
|
||||
this._isRendered = false
|
||||
}
|
||||
|
||||
this.onBrowserStart = function (browser) {
|
||||
this._browsers.push(browser)
|
||||
|
||||
if (this._isRendered) {
|
||||
this.write('\n')
|
||||
}
|
||||
|
||||
this.write(this._refresh())
|
||||
}
|
||||
|
||||
this._remove = function () {
|
||||
if (!this._isRendered) {
|
||||
return ''
|
||||
}
|
||||
|
||||
let cmd = ''
|
||||
this._browsers.forEach(function () {
|
||||
cmd += '\x1B[1A' + '\x1B[2K'
|
||||
})
|
||||
|
||||
this._isRendered = false
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
this._render = function () {
|
||||
this._isRendered = true
|
||||
|
||||
return this._browsers.map(this.renderBrowser).join('\n') + '\n'
|
||||
}
|
||||
|
||||
this._refresh = function () {
|
||||
return this._remove() + this._render()
|
||||
}
|
||||
}
|
||||
|
||||
// PUBLISH
|
||||
module.exports = ProgressReporter
|
11
node_modules/karma/lib/reporters/progress_color.js
generated
vendored
Normal file
11
node_modules/karma/lib/reporters/progress_color.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
const ProgressReporter = require('./progress')
|
||||
const BaseColorReporter = require('./base_color')
|
||||
|
||||
function ProgressColorReporter (formatError, reportSlow, useColors, browserConsoleLogOptions) {
|
||||
ProgressReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
|
||||
BaseColorReporter.call(this)
|
||||
this.EXCLUSIVELY_USE_COLORS = true
|
||||
}
|
||||
|
||||
// PUBLISH
|
||||
module.exports = ProgressColorReporter
|
Loading…
Add table
Add a link
Reference in a new issue