74 lines
1.3 KiB
JavaScript
74 lines
1.3 KiB
JavaScript
getJasmineRequireObj().JsApiReporter = function() {
|
|
|
|
var noopTimer = {
|
|
start: function(){},
|
|
elapsed: function(){ return 0; }
|
|
};
|
|
|
|
function JsApiReporter(options) {
|
|
var timer = options.timer || noopTimer,
|
|
status = 'loaded';
|
|
|
|
this.started = false;
|
|
this.finished = false;
|
|
|
|
this.jasmineStarted = function() {
|
|
this.started = true;
|
|
status = 'started';
|
|
timer.start();
|
|
};
|
|
|
|
var executionTime;
|
|
|
|
this.jasmineDone = function() {
|
|
this.finished = true;
|
|
executionTime = timer.elapsed();
|
|
status = 'done';
|
|
};
|
|
|
|
this.status = function() {
|
|
return status;
|
|
};
|
|
|
|
var suites = {};
|
|
|
|
this.suiteStarted = function(result) {
|
|
storeSuite(result);
|
|
};
|
|
|
|
this.suiteDone = function(result) {
|
|
storeSuite(result);
|
|
};
|
|
|
|
function storeSuite(result) {
|
|
suites[result.id] = result;
|
|
}
|
|
|
|
this.suites = function() {
|
|
return suites;
|
|
};
|
|
|
|
var specs = [];
|
|
this.specStarted = function(result) { };
|
|
|
|
this.specDone = function(result) {
|
|
specs.push(result);
|
|
};
|
|
|
|
this.specResults = function(index, length) {
|
|
return specs.slice(index, index + length);
|
|
};
|
|
|
|
this.specs = function() {
|
|
return specs;
|
|
};
|
|
|
|
this.executionTime = function() {
|
|
return executionTime;
|
|
};
|
|
|
|
}
|
|
|
|
return JsApiReporter;
|
|
};
|