grunt-mocha-phantomjs
grunt-mocha-phantomjs copied to clipboard
Combine output into one report when running multiple files?
More of a request than a bug -- and I may be interested and willing to contribute work if the idea seems cogent: when running grunt mocha_phantomjs
on more than one HTML file, it'd be handy to have a custom reporter that compiles all the output into a single result.
As it stands right now, if it's running on, say, 20 files, and there's a test failure in the first test file, you have to scroll all the way back up through 20 sets of test results to read the error output, rather than a single concatenated set of results.
If the idea seems worth pursuing, a potential follow-up concept would be making it more performant on a large number of files by not starting a fresh Phantom process for each file. That may be more of a concern for the mocha-phantomjs
project than this, though. I'm not intimate enough with the code of either project to know where that line is drawn.
Let me know your thoughts! Like I said, I'd be happy to contribute if you think the idea has merit.
There's no way to do this in a general way. Each html
file is a separate process fork, a separate process run, and each reporter is an opaque black box that has it's own internal state, listening to events that mocha fires. e.g. the json
reporter keeps stats internally until the end
event fires and then dumps it all out to the console. Some like dot
keep no state and just write to the console each time.
The best way is to have just one html
runner with all your tests, and use grep
to just run what you need:
mocha-phantomjs tests/mytests.html?grep=foo
Unfortunately grunt-mocha-phantomjs
doesn't support grep.