1 | window.failedTests = []
|
2 | window.runner = null
|
3 | mocha.run = do ()->
|
4 | orig = mocha.run.bind(mocha)
|
5 | return ()->
|
6 | runner = orig(arguments...)
|
7 |
|
8 | runner.on 'end', ()->
|
9 | window.mochaResults = runner.stats or {}
|
10 | window.mochaResults.reports = window.failedTests
|
11 |
|
12 | runner.on 'pass', ()->
|
13 | runner.on 'fail', (test, err)->
|
14 | failedTests.push
|
15 | name: test.title
|
16 | result: false
|
17 | message: err.message
|
18 | stack: err.stack
|
19 | titles: do ()->
|
20 | titles = []
|
21 | while test.parent.title
|
22 | titles.push test.parent.title
|
23 | test = test.parent
|
24 |
|
25 | return titles.reverse()
|
26 |
|
27 | return runner |
\ | No newline at end of file |