2009-07-10 21:35:24 +00:00
|
|
|
/** JavaScript API reporter.
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
jasmine.JsApiReporter = function() {
|
|
|
|
this.started = false;
|
|
|
|
this.finished = false;
|
|
|
|
this.suites = [];
|
|
|
|
this.results = {};
|
|
|
|
};
|
|
|
|
|
|
|
|
jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
|
|
|
this.started = true;
|
2009-09-02 14:52:11 +00:00
|
|
|
var suites = runner.suites();
|
2009-09-02 04:21:54 +00:00
|
|
|
for (var i = 0; i < suites.length; i++) {
|
|
|
|
var suite = suites[i];
|
2009-07-10 21:35:24 +00:00
|
|
|
this.suites.push(this.summarize_(suite));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
2009-09-02 04:21:54 +00:00
|
|
|
var isSuite = suiteOrSpec instanceof jasmine.Suite
|
2009-07-10 21:35:24 +00:00
|
|
|
var summary = {
|
|
|
|
id: suiteOrSpec.id,
|
|
|
|
name: suiteOrSpec.description,
|
2009-09-02 04:21:54 +00:00
|
|
|
type: isSuite ? 'suite' : 'spec',
|
2009-07-10 21:35:24 +00:00
|
|
|
children: []
|
|
|
|
};
|
2009-09-02 04:21:54 +00:00
|
|
|
if (isSuite) {
|
2009-09-02 14:30:31 +00:00
|
|
|
var specs = suiteOrSpec.specs();
|
2009-09-02 04:21:54 +00:00
|
|
|
for (var i = 0; i < specs.length; i++) {
|
|
|
|
summary.children.push(this.summarize_(specs[i]));
|
2009-07-10 21:35:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return summary;
|
|
|
|
};
|
|
|
|
|
|
|
|
//noinspection JSUnusedLocalSymbols
|
|
|
|
jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
|
|
|
|
this.finished = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
//noinspection JSUnusedLocalSymbols
|
|
|
|
jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
|
|
|
|
};
|
|
|
|
|
|
|
|
//noinspection JSUnusedLocalSymbols
|
|
|
|
jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
|
|
|
|
this.results[spec.id] = {
|
|
|
|
messages: spec.results.getItems(),
|
|
|
|
result: spec.results.failedCount > 0 ? "failed" : "passed"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//noinspection JSUnusedLocalSymbols
|
|
|
|
jasmine.JsApiReporter.prototype.log = function(str) {
|
|
|
|
};
|
|
|
|
|