better reporting

This commit is contained in:
John Bintz 2011-05-12 17:23:42 -04:00
parent b53c4c56f7
commit e761616830
3 changed files with 10 additions and 15 deletions

View File

@ -234,8 +234,9 @@ void HeadlessSpecRunner::finishSuite(const QString &duration, const QString &tot
std::cout << "PASS: "; std::cout << "PASS: ";
} }
std::cout << qPrintable(total) << " tests, " << qPrintable(failed) << " failures, " << qPrintable(duration) << " secs." << std::endl; std::cout << qPrintable(total) << " tests, " << qPrintable(failed) << " failures, " << qPrintable(duration) << " secs.";
clear(); clear();
std::cout << std::endl;
isFinished = true; isFinished = true;
} }

View File

@ -22,9 +22,10 @@ class jasmine.HeadlessReporter
do (result) => do (result) =>
result.print() result.print()
JHW.finishSuite(@totalDuration, @length, @failedCount) JHW.finishSuite(@totalDuration / 1000.0, @length, @failedCount)
reportRunnerStarting: (runner) -> reportRunnerStarting: (runner) ->
reportSpecResults: (spec) -> reportSpecResults: (spec) ->
@totalDuration += (new Date() - spec.startTime)
if spec.results().passed() if spec.results().passed()
JHW.specPassed() JHW.specPassed()
else else
@ -37,9 +38,6 @@ class jasmine.HeadlessReporter
failureResult.results.push(result.message) failureResult.results.push(result.message)
@results.push(failureResult) @results.push(failureResult)
reportSpecStarting: (spec) -> reportSpecStarting: (spec) ->
# something here spec.startTime = new Date()
reportSuiteResults: (suite) -> reportSuiteResults: (suite) ->
suite.startTime ?= new Date()
@totalDuration += (new Date() - suite.startTime) / 1000.0;
@length += suite.specs().length @length += suite.specs().length

View File

@ -41,11 +41,12 @@
result = _ref[_i]; result = _ref[_i];
_fn(result); _fn(result);
} }
return JHW.finishSuite(this.totalDuration, this.length, this.failedCount); return JHW.finishSuite(this.totalDuration / 1000.0, this.length, this.failedCount);
}; };
HeadlessReporter.prototype.reportRunnerStarting = function(runner) {}; HeadlessReporter.prototype.reportRunnerStarting = function(runner) {};
HeadlessReporter.prototype.reportSpecResults = function(spec) { HeadlessReporter.prototype.reportSpecResults = function(spec) {
var failureResult, result, _fn, _i, _len, _ref; var failureResult, result, _fn, _i, _len, _ref;
this.totalDuration += new Date() - spec.startTime;
if (spec.results().passed()) { if (spec.results().passed()) {
return JHW.specPassed(); return JHW.specPassed();
} else { } else {
@ -65,15 +66,10 @@
return this.results.push(failureResult); return this.results.push(failureResult);
} }
}; };
HeadlessReporter.prototype.reportSpecStarting = function(spec) {}; HeadlessReporter.prototype.reportSpecStarting = function(spec) {
return spec.startTime = new Date();
};
HeadlessReporter.prototype.reportSuiteResults = function(suite) { HeadlessReporter.prototype.reportSuiteResults = function(suite) {
var _ref;
if ((_ref = suite.startTime) != null) {
_ref;
} else {
suite.startTime = new Date();
};
this.totalDuration += (new Date() - suite.startTime) / 1000.0;
return this.length += suite.specs().length; return this.length += suite.specs().length;
}; };
return HeadlessReporter; return HeadlessReporter;