Add execution time elapsed to JsApiReporter
Since this information is desired in ConsoleReporter, HtmlReporter, and now JsApiReporter, the executionTime is passed through in jasmineDone from Env instead of making each reporter compute it. Fixes #30, [Finishes #45659879]
This commit is contained in:
@@ -2,7 +2,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
function Env(options) {
|
||||
options = options || {};
|
||||
var self = this;
|
||||
var global = options.global || j$.getGlobal();
|
||||
var global = options.global || j$.getGlobal(),
|
||||
now = options.now || function() { return new Date().getTime(); };
|
||||
|
||||
var catchExceptions = true;
|
||||
|
||||
@@ -192,10 +193,13 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.execute = function() {
|
||||
var startTime = now();
|
||||
this.reporter.jasmineStarted({
|
||||
totalSpecsDefined: totalSpecsDefined
|
||||
});
|
||||
this.topSuite.execute(this.reporter.jasmineDone);
|
||||
this.topSuite.execute(function() {
|
||||
self.reporter.jasmineDone({executionTime: now() - startTime});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,11 @@ getJasmineRequireObj().JsApiReporter = function() {
|
||||
status = 'started';
|
||||
};
|
||||
|
||||
this.jasmineDone = function() {
|
||||
var executionTime;
|
||||
|
||||
this.jasmineDone = function(options) {
|
||||
this.finished = true;
|
||||
executionTime = options.executionTime;
|
||||
status = 'done';
|
||||
};
|
||||
|
||||
@@ -53,6 +56,10 @@ getJasmineRequireObj().JsApiReporter = function() {
|
||||
return specs;
|
||||
};
|
||||
|
||||
this.executionTime = function() {
|
||||
return executionTime;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return JsApiReporter;
|
||||
|
||||
Reference in New Issue
Block a user