Refactored into class files. Meta-tests and runner for jasmine. Stack traces available for Firefox and supported browsers. Experimental pretty print matcher support. Many other new features
This commit is contained in:
49
src/NestedResults.js
Normal file
49
src/NestedResults.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Holds results; allows for the results array to hold another jasmine.NestedResults
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
jasmine.NestedResults = function() {
|
||||
this.totalCount = 0;
|
||||
this.passedCount = 0;
|
||||
this.failedCount = 0;
|
||||
this.skipped = false;
|
||||
this.items_ = [];
|
||||
};
|
||||
|
||||
jasmine.NestedResults.prototype.rollupCounts = function(result) {
|
||||
this.totalCount += result.totalCount;
|
||||
this.passedCount += result.passedCount;
|
||||
this.failedCount += result.failedCount;
|
||||
};
|
||||
|
||||
jasmine.NestedResults.prototype.log = function(message) {
|
||||
this.items_.push(new jasmine.MessageResult(message));
|
||||
};
|
||||
|
||||
jasmine.NestedResults.prototype.getItems = function() {
|
||||
return this.items_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {jasmine.ExpectationResult|jasmine.NestedResults} result
|
||||
*/
|
||||
jasmine.NestedResults.prototype.addResult = function(result) {
|
||||
if (result.type != 'MessageResult') {
|
||||
if (result.items_) {
|
||||
this.rollupCounts(result);
|
||||
} else {
|
||||
this.totalCount++;
|
||||
if (result.passed) {
|
||||
this.passedCount++;
|
||||
} else {
|
||||
this.failedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.items_.push(result);
|
||||
};
|
||||
|
||||
jasmine.NestedResults.prototype.passed = function() {
|
||||
return this.passedCount === this.totalCount;
|
||||
};
|
||||
Reference in New Issue
Block a user