Skip to content

Commit 6def761

Browse files
committed
Merge pull request #100 from jzaefferer/fix-jasmine-patch
Fix jasmine patch
2 parents affa500 + a915186 commit 6def761

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

lib/_patch/jasmine-plugin.js

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,45 @@
11
(function(){
22
function countSpecs(suite, results){
3-
suite.specs.forEach(function(s){
4-
if(s.passed){
5-
results.passed++;
6-
}else{
7-
results.tracebacks.push(s.description);
8-
results.failed++;
3+
for (var i = 0; i < suite.specs.length; ++i) {
4+
if (suite.specs[i].passed){
5+
results.passed++;
6+
} else {
7+
results.tracebacks.push(suite.specs[i].description);
8+
results.failed++;
99
}
10-
});
11-
suite.suites.forEach(function(s){
12-
results = countSpecs(s, results);
13-
});
14-
return(results);
10+
}
11+
12+
for (var i = 0; i < suite.suites.length; ++i) {
13+
if (suite.suites[i]) {
14+
results = countSpecs(suite.suites[i], results);
15+
}
16+
}
17+
18+
return results;
1519
}
1620

17-
var checker = setInterval(function(){
18-
if(!jasmine.running){
19-
var results = {}
20-
var report = jasmine.getJSReport()
21-
var errors = [];
21+
var checker = setInterval(function() {
22+
if (!jasmine.running) {
23+
var results = {};
24+
var report = jasmine.getJSReport();
2225
results.runtime = report.durationSec * 1000;
23-
results.total=0;
24-
results.passed=0;
25-
results.failed=0;
26-
results.tracebacks=[];
26+
results.total = 0;
27+
results.passed = 0;
28+
results.failed = 0;
29+
results.tracebacks = [];
30+
31+
for (var i = 0; i < report.suites.length; ++i) {
32+
if (report.suites[i]) {
33+
results = countSpecs(report.suites[i], results);
34+
}
35+
}
2736

28-
jasmine.getJSReport().suites.forEach(function(suite){
29-
results = countSpecs(suite, results);
30-
});
3137
results.total = results.passed + results.failed;
3238

3339
results.url = window.location.pathname;
3440
BrowserStack.post("/_report", results, function(){});
41+
clearInterval(checker);
3542
}
36-
clearInterval(checker);
3743
}, 1000);
3844
})();
3945

0 commit comments

Comments
 (0)