pulsar/spec/jasmine-list-reporter.js

36 lines
896 B
JavaScript
Raw Normal View History

2019-02-22 10:55:17 +03:00
const { TerminalReporter } = require('jasmine-tagged')
class JasmineListReporter extends TerminalReporter {
fullDescription (spec) {
let fullDescription = spec.description
let currentSuite = spec.suite
while (currentSuite) {
fullDescription = currentSuite.description + ' > ' + fullDescription
currentSuite = currentSuite.parentSuite
}
return fullDescription
}
reportSpecStarting (spec) {
this.print_(this.fullDescription(spec) + ' ')
}
reportSpecResults (spec) {
const result = spec.results()
if (result.skipped) {
2019-02-05 18:40:52 +03:00
return
}
let msg = ''
if (result.passed()) {
msg = this.stringWithColor_('[pass]', this.color_.pass())
} else {
msg = this.stringWithColor_('[FAIL]', this.color_.fail())
this.addFailureToFailures_(spec)
}
this.printLine_(msg)
}
}
module.exports = { JasmineListReporter }