Multiple reporters + external reporter packages

24 views
Skip to first unread message

Danny Hadley

unread,
Apr 28, 2017, 12:42:44 PM4/28/17
to Testem Users
Hey all, the client-side application we're building at my current job is built using ember and uses testem to run our quint tests. Previously I've used karma and jasmine for this purpose with karma being used in place of testem. One of the features I really enjoyed about karma was it's support for multiple reporters.

For me, while working on any codebase, I would like to be actively running tests while writing code - keeping the test running process in the background with my editor being my primary focus. With tools like anybar, I was able to reflect the status of my test execution in the OSX menu bar - allowing me to continuously write code while also knowing the status of the tests at the same time. I'd still want the test output to write to my terminal as usual, with the anybar indicator as a supplemental peripheral. This was made extremely easy with a test runner that supported multiple reporters - I could just karma run --single-run=false --reporters=dots,anybar. In order to accomplish the same thing in testem, I would have to build a single reporter that does both. 

Another thing that would be nice is to have custom reporters that can be installed as npm packages and referenced via their package name as the argument to the --reporter flag rather than having to muddle the testem.js configuration file with the import and instantiation of the imported reporter like that seen in the custom reporter example.

Is there a specific reason why testem only supports one reporter and why reporters must be initialized that way? In the lib/utils/reporter.js module, would something like the following code be unwelcome?

// ...
var
TestReporter = reporters[name] || require(name);
// ...

and for multiple reporters:

this.reporters = config.get('reporters') ? config.get('reporters').map(/* something there */) : [setupReporter(config.get('reporter'), stdout, config, app)];

- Danny

Johannes Würbach

unread,
Apr 30, 2017, 3:12:14 PM4/30/17
to Testem Users
Hello Danny,

multi-reporter support was planned, but sadly never finished. A PR finalizing this is more then welcome and feel free to send already work in progress code so I can help you getting it merge asap.

Cheers,
Johannes
Reply all
Reply to author
Forward
0 new messages