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