|
1 | 1 | (function() {
|
2 |
| - var checker = setInterval(function() { |
3 |
| - if (!jasmine.running) { |
4 |
| - var results = {}; |
5 |
| - var specs = jsApiReporter.specs(); |
6 |
| - results.runtime = jsApiReporter.executionTime(); |
7 |
| - results.total = 0; |
8 |
| - results.passed = 0; |
9 |
| - results.failed = 0; |
10 |
| - results.tracebacks = []; |
| 2 | + var runner = new JsReporters.JasmineAdapter(jasmine.getEnv()); |
| 3 | + var tracebacks = []; |
| 4 | + var total = 0, |
| 5 | + passed = 0, |
| 6 | + failed = 0; |
11 | 7 |
|
12 |
| - for (var spec in specs) { |
13 |
| - if (specs[spec].status === 'passed') { |
14 |
| - results.passed++; |
15 |
| - } else { |
16 |
| - results.tracebacks.push(specs[spec].description); |
17 |
| - results.failed++; |
18 |
| - } |
19 |
| - } |
| 8 | + runner.on('testEnd', function(test) { |
| 9 | + total = total + 1 |
20 | 10 |
|
21 |
| - results.total = results.passed + results.failed; |
22 |
| - results.url = window.location.pathname; |
23 |
| - BrowserStack.post('/_report', results, function(){}); |
24 |
| - } |
25 |
| - clearInterval(checker); |
26 |
| - }, 1000); |
| 11 | + passed = passed + (test.status === 'passed' ? 1 : 0); |
| 12 | + failed = failed + (test.status === 'failed' ? 1 : 0); |
| 13 | + |
| 14 | + test.errors.forEach(function(error) { |
| 15 | + tracebacks.push(error) |
| 16 | + }); |
| 17 | + }); |
| 18 | + |
| 19 | + runner.on('runEnd', function(globalSuite) { |
| 20 | + var results = {}; |
| 21 | + |
| 22 | + results.runtime = globalSuite.runtime; |
| 23 | + results.total = total; |
| 24 | + results.passed = passed; |
| 25 | + results.failed = failed; |
| 26 | + results.tracebacks = tracebacks; |
| 27 | + results.url = window.location.pathname; |
| 28 | + |
| 29 | + BrowserStack.post("/_report", results, function() {}); |
| 30 | + }); |
27 | 31 | })();
|
28 | 32 |
|
0 commit comments