UNPKG

600 Btext/coffeescriptView Raw
1window.failedTests = []
2window.runner = null
3mocha.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