|
7 | 7 | factory(QUnit);
|
8 | 8 | }
|
9 | 9 | }(function(QUnit) {
|
10 |
| - var failedAssertions = []; |
11 |
| - var options, |
12 |
| - currentModule, |
13 |
| - currentTest, |
14 |
| - setTimeoutVariable; |
15 |
| - var pendingTest = {}; |
| 10 | + var runner = new JsReporters.QUnitAdapter(QUnit); |
| 11 | + var tracebacks = []; |
| 12 | + var total = 0, |
| 13 | + passed = 0, |
| 14 | + failed = 0; |
16 | 15 |
|
17 |
| - var testTimeout = function() { |
18 |
| - var error = { |
19 |
| - testName: currentTest, |
20 |
| - message: "Stuck on this test for 60 sec." |
21 |
| - }; |
| 16 | + runner.on('testEnd', function(test) { |
| 17 | + total = total + 1 |
22 | 18 |
|
23 |
| - BrowserStack.post('/_progress', { |
24 |
| - tracebacks: [error] |
25 |
| - }, function(){}); |
26 |
| - }; |
| 19 | + passed = passed + (test.status === 'passed' ? 1 : 0); |
| 20 | + failed = failed + (test.status === 'failed' ? 1 : 0); |
27 | 21 |
|
28 |
| - QUnit.testDone(function(details) { |
29 |
| - var ct = details.module + " - " + details.name; |
30 |
| - clearTimeout(pendingTest[ct]); |
| 22 | + test.errors.forEach(function(error) { |
| 23 | + tracebacks.push(error) |
| 24 | + }); |
31 | 25 | });
|
32 | 26 |
|
33 |
| - QUnit.testStart(function(details) { |
34 |
| - currentTest = details.module + " - " + details.name; |
35 |
| - pendingTest[currentTest] = setTimeout(function() { |
36 |
| - testTimeout(currentTest); |
37 |
| - }, 60000); |
38 |
| - }); |
39 |
| - |
40 |
| - QUnit.log(function(details) { |
41 |
| - if (details.result) { |
42 |
| - return; |
43 |
| - } |
44 |
| - |
45 |
| - var error = { |
46 |
| - actual: details.actual, |
47 |
| - expected: details.expected, |
48 |
| - message: details.message, |
49 |
| - source: details.source, |
50 |
| - testName:( details.module + ": " + details.name) |
51 |
| - }; |
| 27 | + runner.on('runEnd', function(globalSuite) { |
| 28 | + var results = {}; |
52 | 29 |
|
53 |
| - BrowserStack.post('/_progress', { |
54 |
| - tracebacks: [error] |
55 |
| - }, function(){}); |
56 |
| - }); |
57 |
| - |
58 |
| - QUnit.done(function(results) { |
| 30 | + results.runtime = globalSuite.runtime; |
| 31 | + results.total = total; |
| 32 | + results.passed = passed; |
| 33 | + results.failed = failed; |
| 34 | + results.tracebacks = tracebacks; |
59 | 35 | results.url = window.location.pathname;
|
| 36 | + |
60 | 37 | BrowserStack.post("/_report", results, function(){});
|
61 | 38 | });
|
62 | 39 | }));
|
0 commit comments