Jest: No custom test reporters

Created on 4 Apr 2016  路  7Comments  路  Source: facebook/jest

Like mocha`s:

Spec
Nyan
Dot Matrix
TAP
etc.

Most helpful comment

Could we reopen this now that Jest is popular? I would love to consolidate on using jest for testing node apps, but this is a major blocker. The current hacks of using jasmine-reporters should not be the solution for an important task of a test framework.

All 7 comments

Unfortunately we are not currently planning on working on this. If you'd like to help out and add more custom test reporter features, I'd be happy to work with you on a Pull Request :)

Closing this because there has been a month of inactivity. Happy to receive pull requests for this if anyone is interested in working on it.

This is how I worked it around:

in package.json

  "jest": {
    "setupTestFrameworkScriptFile": "./test/setup_framework.js",

In setup_framework.js:

  jasmine.getEnv().addReporter(reporter);  // add your reporter
  jasmine.getEnv().addReporter = () => {}; // prevent Jest from adding their reporter

This works as Jasmine adds their reporter _afterwards_.

Also check out this: https://github.com/jasmine/jasmine/issues/1183

Since you can only add reporters to jasmine and not remove them, this workaround might stop working at some point if Jest decided the add the reporter before the file mentioned.

Update this doesn't quite work as running the whole suite does not seem to finish (single files do).

Could we reopen this now that Jest is popular? I would love to consolidate on using jest for testing node apps, but this is a major blocker. The current hacks of using jasmine-reporters should not be the solution for an important task of a test framework.

"zero configuration" really doesn't have to mean "no configuration".

I'm not going to lie, I just want this implemented so I can use the nyan cat reporter.

You can use custom reporters in jest@20. https://facebook.github.io/jest/docs/en/configuration.html#reporters-array-modulename-modulename-options, #3349

Was this page helpful?
0 / 5 - 0 ratings