Refactor suite timing out of Env and into each Reporter
[finishes #45659879]
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
getJasmineRequireObj().JsApiReporter = function() {
|
||||
function JsApiReporter(jasmine) { // TODO: this doesn't appear to be used
|
||||
this.jasmine = jasmine || {};
|
||||
|
||||
var noopTimer = {
|
||||
start: function(){},
|
||||
elapsed: function(){ return 0; }
|
||||
};
|
||||
|
||||
function JsApiReporter(options) {
|
||||
var timer = options.timer || noopTimer,
|
||||
status = "loaded";
|
||||
|
||||
this.started = false;
|
||||
this.finished = false;
|
||||
|
||||
var status = 'loaded';
|
||||
|
||||
this.jasmineStarted = function() {
|
||||
this.started = true;
|
||||
status = 'started';
|
||||
timer.start();
|
||||
};
|
||||
|
||||
var executionTime;
|
||||
|
||||
this.jasmineDone = function(options) {
|
||||
this.jasmineDone = function() {
|
||||
this.finished = true;
|
||||
executionTime = options.executionTime;
|
||||
executionTime = timer.elapsed();
|
||||
status = 'done';
|
||||
};
|
||||
|
||||
|
||||
18
src/core/Timer.js
Normal file
18
src/core/Timer.js
Normal file
@@ -0,0 +1,18 @@
|
||||
getJasmineRequireObj().Timer = function() {
|
||||
function Timer(options) {
|
||||
options = options || {};
|
||||
|
||||
var now = options.now || function() { return new Date().getTime(); },
|
||||
startTime;
|
||||
|
||||
this.start = function() {
|
||||
startTime = now();
|
||||
};
|
||||
|
||||
this.elapsed = function() {
|
||||
return now() - startTime;
|
||||
};
|
||||
}
|
||||
|
||||
return Timer;
|
||||
};
|
||||
@@ -28,6 +28,7 @@ getJasmineRequireObj().core = function(jRequire) {
|
||||
j$.Spec = jRequire.Spec();
|
||||
j$.Spy = jRequire.Spy(j$);
|
||||
j$.Suite = jRequire.Suite();
|
||||
j$.Timer = jRequire.Timer();
|
||||
j$.version = jRequire.version();
|
||||
|
||||
j$.matchers = jRequire.requireMatchers(jRequire, j$);
|
||||
|
||||
Reference in New Issue
Block a user