finalize the runner, time to merge?

This commit is contained in:
John Bintz 2011-11-05 14:19:41 -04:00
parent 3a559fb0d5
commit 5ca065728d
6 changed files with 30 additions and 13 deletions

View File

@ -14,6 +14,7 @@ using namespace std;
Runner::Runner() : QObject()
, runs(0)
, hasErrors(false)
, _hasSpecFailure(false)
, usedConsole(false)
, isFinished(false)
, useColors(false)
@ -99,6 +100,10 @@ void Runner::hasError() {
hasErrors = true;
}
void Runner::hasSpecFailure() {
_hasSpecFailure = true;
}
void Runner::reportFile(const QString &file) {
reportFileName = file;
}
@ -144,7 +149,7 @@ void Runner::timerEvent() {
}
int exitCode = 0;
if (hasErrors) {
if (_hasSpecFailure || hasErrors) {
exitCode = 1;
} else {
if (usedConsole) {

View File

@ -29,6 +29,7 @@ class Runner: public QObject {
void timerDone();
void hasUsedConsole();
void hasError();
void hasSpecFailure();
void print(const QString &fh, const QString &content);
void finishSuite();
@ -43,6 +44,7 @@ class Runner: public QObject {
QTimer ticker;
int runs;
bool hasErrors;
bool _hasSpecFailure;
bool usedConsole;
bool isFinished;
bool useColors;

View File

@ -10,9 +10,6 @@ class jasmine.HeadlessConsoleReporter
reportRunnerResults: (runner) ->
return if this.hasError()
if window.JHW
window.onbeforeunload = null
runtime = (new Date() - @startTime) / 1000.0
JHW.stdout.print("\n")
@ -23,12 +20,16 @@ class jasmine.HeadlessConsoleReporter
JHW.stdout.puts("PASS: #{resultLine}".foreground('green'))
else
JHW.stdout.puts("FAIL: #{resultLine}".foreground('red'))
JHW.hasSpecFailure()
output = "TOTAL||#{@length}||#{@failedCount}||#{runtime}||#{if JHW._hasErrors then "T" else "F"}"
JHW.report.puts(output)
result.print() for result in @results
if window.JHW
window.onbeforeunload = null
JHW.finishSuite()
reportRunnerStarting: (runner) ->
@ -47,7 +48,6 @@ class jasmine.HeadlessConsoleReporter
else
JHW.stdout.print('F'.foreground('red'))
JHW.report.puts("FAIL||" + spec.getJHWSpecInformation())
JHW.hasError()
@failedCount++
failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName())

View File

@ -27,9 +27,15 @@ if window.JHW
data
window.onbeforeunload = (e) ->
JHW.stderr.puts('The code tried to leave the test page. Check for unhandled form submits and link clicks.')
e = e || window.event
JHW.hasError()
return false
JHW.stdout.puts('The code tried to leave the test page. Check for unhandled form submits and link clicks.')
if e
e.returnValue = 'string'
return 'string'
window.confirm = (message) ->
JHW.stderr.puts("#{"[confirm]".foreground('red')} jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true.")

View File

@ -14,9 +14,6 @@
if (this.hasError()) {
return;
}
if (window.JHW) {
window.onbeforeunload = null;
}
runtime = (new Date() - this.startTime) / 1000.0;
JHW.stdout.print("\n");
resultLine = this._formatResultLine(runtime);
@ -24,6 +21,7 @@
JHW.stdout.puts(("PASS: " + resultLine).foreground('green'));
} else {
JHW.stdout.puts(("FAIL: " + resultLine).foreground('red'));
JHW.hasSpecFailure();
}
output = "TOTAL||" + this.length + "||" + this.failedCount + "||" + runtime + "||" + (JHW._hasErrors ? "T" : "F");
JHW.report.puts(output);
@ -32,6 +30,9 @@
result = _ref[_i];
result.print();
}
if (window.JHW) {
window.onbeforeunload = null;
}
return JHW.finishSuite();
};
HeadlessConsoleReporter.prototype.reportRunnerStarting = function(runner) {
@ -51,7 +52,6 @@
} else {
JHW.stdout.print('F'.foreground('red'));
JHW.report.puts("FAIL||" + spec.getJHWSpecInformation());
JHW.hasError();
this.failedCount++;
failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName());
testCount = 1;

View File

@ -37,9 +37,13 @@
}
};
window.onbeforeunload = function(e) {
JHW.stderr.puts('The code tried to leave the test page. Check for unhandled form submits and link clicks.');
e = e || window.event;
JHW.hasError();
return false;
JHW.stdout.puts('The code tried to leave the test page. Check for unhandled form submits and link clicks.');
if (e) {
e.returnValue = 'string';
}
return 'string';
};
window.confirm = function(message) {
JHW.stderr.puts("" + ("[confirm]".foreground('red')) + " jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true.");