call back when done
This commit is contained in:
parent
88ee377662
commit
a1ba43c864
|
@ -47,7 +47,11 @@ describe("TrivialConsoleReporter", function() {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
this.reporter = new jasmine.TrivialConsoleReporter(this.out.print);
|
this.done = false
|
||||||
|
var self = this
|
||||||
|
this.reporter = new jasmine.TrivialConsoleReporter(this.out.print, function(runner){
|
||||||
|
self.done = true
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -408,6 +412,16 @@ describe("TrivialConsoleReporter", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("done callback", function(){
|
||||||
|
it("calls back when done", function() {
|
||||||
|
expect(this.done).toBeFalsy();
|
||||||
|
this.reporter.reportRunnerResults({
|
||||||
|
results:function(){return {items_: [null, null, null], totalCount: 7, failedCount: 0};}
|
||||||
|
});
|
||||||
|
expect(this.done).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
jasmine.TrivialConsoleReporter = function(print) {
|
jasmine.TrivialConsoleReporter = function(print, doneCallback) {
|
||||||
|
|
||||||
//inspired by mhevery's jasmine-node reporter
|
//inspired by mhevery's jasmine-node reporter
|
||||||
//https://github.com/mhevery/jasmine-node
|
//https://github.com/mhevery/jasmine-node
|
||||||
|
|
||||||
|
doneCallback = doneCallback || function(){};
|
||||||
|
|
||||||
var defaultColumnsPerLine = 50,
|
var defaultColumnsPerLine = 50,
|
||||||
ansi = { green: '\033[32m', red: '\033[31m', yellow: '\033[33m', none: '\033[0m' },
|
ansi = { green: '\033[32m', red: '\033[31m', yellow: '\033[33m', none: '\033[0m' },
|
||||||
language = { spec:"spec", assertion:"assertion", failure:"failure" };
|
language = { spec:"spec", assertion:"assertion", failure:"failure" };
|
||||||
|
@ -138,5 +139,6 @@ jasmine.TrivialConsoleReporter = function(print) {
|
||||||
var results = runner.results();
|
var results = runner.results();
|
||||||
var summaryFunction = results.failedCount === 0 ? greenSummary : redSummary;
|
var summaryFunction = results.failedCount === 0 ? greenSummary : redSummary;
|
||||||
summaryFunction(results.items_.length, results.totalCount, results.failedCount);
|
summaryFunction(results.items_.length, results.totalCount, results.failedCount);
|
||||||
|
doneCallback(runner);
|
||||||
};
|
};
|
||||||
};
|
};
|
Loading…
Reference in New Issue