-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
JsApiReporter.js
73 lines (54 loc) · 1.33 KB
/
JsApiReporter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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;
};