Skip to content

Instantly share code, notes, and snippets.

@fonzerelly
Last active January 3, 2016 19:59
Show Gist options
  • Save fonzerelly/8512184 to your computer and use it in GitHub Desktop.
Save fonzerelly/8512184 to your computer and use it in GitHub Desktop.
TextReporter.prototype = new jasmine.Reporter();
TextReporter.prototype.onRunnerFinished = function (callback) {
this.callbackEnd = callback;
};
TextReporter.prototype.reportRunnerResults = function (runner) {
// When all the spec are finished //
var result = runner.results();
this.textResult += "Test results :: (" + result.passedCount + "/" + result.totalCount + ") :: " + (result.passed() ? "passed" : "failed");
this.textResult += "\r\n";
if (this.callbackEnd) {
this.callbackEnd(this.textResult);
}
};
TextReporter.prototype.reportSuiteResults = function (suite) {
// When a group of spec has finished running //
var result = suite.results();
var description = suite.description;
};
TextReporter.prototype.reportSpecResults = function(spec) {
// When a single spec has finished running //
var result = spec.results();
var that = this;
that.textResult += "Spec :: " + spec.description + " :: " + (result.passed() ? "passed" : "failed");
that.textResult += "\r\n";
/**** Added to report Error-Mesages during the test execution ***/
if (!result.passed()) {
spec.results().getItems().forEach(function (item) {
if (!item.passed()) {
that.textResult += "\t" +item.message;
that.textResult += "\r\n";
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment