Merge in Pivotal changes
This commit is contained in:
@@ -35,7 +35,7 @@ jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||
|
||||
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||
var specDiv = this.createDom('div', {
|
||||
className: spec.getResults().passed() ? 'spec passed' : 'spec failed'
|
||||
className: spec.getResults().passed ? 'spec passed' : 'spec failed'
|
||||
}, spec.getFullName());
|
||||
|
||||
var resultItems = spec.getResults().getItems();
|
||||
|
||||
@@ -587,6 +587,7 @@ jasmine.Env = function() {
|
||||
};
|
||||
|
||||
this.nextSpecId_ = 0;
|
||||
this.nextSuiteId_ = 0;
|
||||
this.equalityTesters_ = [];
|
||||
};
|
||||
|
||||
@@ -869,7 +870,7 @@ jasmine.Reporter.prototype.reportSpecResults = function(spec) {
|
||||
};
|
||||
|
||||
//noinspection JSUnusedLocalSymbols
|
||||
jasmine.Reporter.prototype.log = function (str) {
|
||||
jasmine.Reporter.prototype.log = function(str) {
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -914,7 +915,8 @@ jasmine.Block.prototype.fail = function(e) {
|
||||
*/
|
||||
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
||||
jasmine.ActionCollection.call(this, env);
|
||||
|
||||
|
||||
this.id = env.nextSuiteId_++;
|
||||
this.description = description;
|
||||
this.specs = this.actions;
|
||||
this.parentSuite = parentSuite;
|
||||
@@ -948,6 +950,9 @@ jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
||||
|
||||
jasmine.Suite.prototype.getResults = function() {
|
||||
var results = new jasmine.NestedResults();
|
||||
results.description = this.description;
|
||||
results.id = this.id;
|
||||
|
||||
for (var i = 0; i < this.specs.length; i++) {
|
||||
results.rollupCounts(this.specs[i].getResults());
|
||||
}
|
||||
@@ -984,7 +989,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
||||
} else if (value instanceof jasmine.Matchers.Any) {
|
||||
this.emitScalar(value.toString());
|
||||
} else if (typeof value === 'string') {
|
||||
this.emitScalar("'" + value + "'");
|
||||
this.emitString(value);
|
||||
} else if (typeof value === 'function') {
|
||||
this.emitScalar('Function');
|
||||
} else if (typeof value.nodeType === 'number') {
|
||||
@@ -1019,6 +1024,7 @@ jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
||||
jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
|
||||
jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
|
||||
jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
|
||||
jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
|
||||
|
||||
jasmine.StringPrettyPrinter = function() {
|
||||
jasmine.PrettyPrinter.call(this);
|
||||
@@ -1031,6 +1037,10 @@ jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
|
||||
this.append(value);
|
||||
};
|
||||
|
||||
jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
|
||||
this.append("'" + value + "'");
|
||||
};
|
||||
|
||||
jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
|
||||
this.append('[ ');
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
@@ -1097,6 +1107,64 @@ jasmine.MultiReporter.prototype.addReporter = function(reporter) {
|
||||
})(functionName);
|
||||
}
|
||||
})();
|
||||
/** 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;
|
||||
|
||||
for (var i = 0; i < runner.suites.length; i++) {
|
||||
var suite = runner.suites[i];
|
||||
this.suites.push(this.summarize_(suite));
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
|
||||
var summary = {
|
||||
id: suiteOrSpec.id,
|
||||
name: suiteOrSpec.description,
|
||||
type: suiteOrSpec instanceof jasmine.Suite ? 'suite' : 'spec',
|
||||
children: []
|
||||
};
|
||||
|
||||
if (suiteOrSpec.specs) {
|
||||
for (var i = 0; i < suiteOrSpec.specs.length; i++) {
|
||||
summary.children.push(this.summarize_(suiteOrSpec.specs[i]));
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
|
||||
*
|
||||
@@ -1174,9 +1242,9 @@ jasmine.NestedResults.prototype.addResult = function(result) {
|
||||
/**
|
||||
* @returns {Boolean} True if <b>everything</b> below passed
|
||||
*/
|
||||
jasmine.NestedResults.prototype.passed = function() {
|
||||
jasmine.NestedResults.prototype.__defineGetter__('passed', function() {
|
||||
return this.passedCount === this.totalCount;
|
||||
};
|
||||
});
|
||||
/**
|
||||
* Runner
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user