JsApiReporter reports nested suites correctly.
Runner#topLevelSuites() returns only top level suites. Suite#specs(), Suite#suites(), and Suite#children() return immediate children.
This commit is contained in:
@@ -28,8 +28,6 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
|
||||
};
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
var suites = runner.suites();
|
||||
|
||||
var showPassed, showSkipped;
|
||||
|
||||
this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
|
||||
@@ -54,6 +52,7 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
|
||||
this.document.body.appendChild(this.outerDiv);
|
||||
|
||||
var suites = runner.suites();
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var suite = suites[i];
|
||||
var suiteDiv = this.createDom('div', { className: 'suite' },
|
||||
|
||||
@@ -976,7 +976,7 @@ jasmine.JsApiReporter = function() {
|
||||
|
||||
jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
this.started = true;
|
||||
var suites = runner.suites();
|
||||
var suites = runner.topLevelSuites();
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var suite = suites[i];
|
||||
this.suites_.push(this.summarize_(suite));
|
||||
@@ -995,10 +995,11 @@ jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
type: isSuite ? 'suite' : 'spec',
|
||||
children: []
|
||||
};
|
||||
|
||||
if (isSuite) {
|
||||
var specs = suiteOrSpec.specs();
|
||||
for (var i = 0; i < specs.length; i++) {
|
||||
summary.children.push(this.summarize_(specs[i]));
|
||||
var children = suiteOrSpec.children();
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
summary.children.push(this.summarize_(children[i]));
|
||||
}
|
||||
}
|
||||
return summary;
|
||||
@@ -1829,11 +1830,20 @@ jasmine.Runner.prototype.specs = function () {
|
||||
return specs;
|
||||
};
|
||||
|
||||
|
||||
jasmine.Runner.prototype.suites = function() {
|
||||
return this.suites_;
|
||||
};
|
||||
|
||||
jasmine.Runner.prototype.topLevelSuites = function() {
|
||||
var topLevelSuites = [];
|
||||
for (var i = 0; i < this.suites_.length; i++) {
|
||||
if (!this.suites_[i].parentSuite) {
|
||||
topLevelSuites.push(this.suites_[i]);
|
||||
}
|
||||
}
|
||||
return topLevelSuites;
|
||||
};
|
||||
|
||||
jasmine.Runner.prototype.results = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
@@ -2061,6 +2071,8 @@ jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
||||
self.env = env;
|
||||
self.before_ = [];
|
||||
self.after_ = [];
|
||||
self.children_ = [];
|
||||
self.suites_ = [];
|
||||
self.specs_ = [];
|
||||
};
|
||||
|
||||
@@ -2095,7 +2107,9 @@ jasmine.Suite.prototype.results = function() {
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.add = function(block) {
|
||||
this.children_.push(block);
|
||||
if (block instanceof jasmine.Suite) {
|
||||
this.suites_.push(block);
|
||||
this.env.currentRunner().addSuite(block);
|
||||
} else {
|
||||
this.specs_.push(block);
|
||||
@@ -2107,6 +2121,14 @@ jasmine.Suite.prototype.specs = function() {
|
||||
return this.specs_;
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.suites = function() {
|
||||
return this.suites_;
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.children = function() {
|
||||
return this.children_;
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.execute = function(onComplete) {
|
||||
var self = this;
|
||||
this.queue.start(function () {
|
||||
@@ -2345,5 +2367,5 @@ jasmine.version_= {
|
||||
"major": 0,
|
||||
"minor": 10,
|
||||
"build": 4,
|
||||
"revision": 1275748595
|
||||
"revision": 1277227072
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user