Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is testResultsProcessor support deprecated? #56

Closed
johngrogg opened this issue Jun 19, 2018 · 4 comments
Closed

Why is testResultsProcessor support deprecated? #56

johngrogg opened this issue Jun 19, 2018 · 4 comments

Comments

@johngrogg
Copy link

I'm wondering why jest --ci --testResultsProcessor="jest-junit" is a deprecated pattern? It's super useful to set the results processor at the command line for CI environments (no need to have the junit file artifact generated when running tests locally).

@sarod
Copy link
Contributor

sarod commented Jun 19, 2018

@johngrogg I don't know why result processor is deprecated.

However if you want to avoid generating the junit file in dev you can have a jest config dedicated for CI environment that overrides the reporters config.

Here is an example of jest.config.ci.js that replaces the "reporters"

const baseConfig = require('./jest.config');

module.exports = {
   ...baseConfig,
   "reporters": [ "jest-junit"]
}

Then you run jest --ci --config=jest.config.ci.js in your CI environement.

@palmerj3
Copy link
Collaborator

@johngrogg it's deprecated because testResultsProcessor will eventually be removed from Jest and I wanted to start preparing jest-junit users to switch to reporters. Reporters and testResultsProcessor offers almost exactly the same API.

Another compelling reason is @sarod recent feature. I'm sure there will be more like this. The reporter API offers the ability to use functions for configuration whereas a testResultsProcessor doesn't offer this capability.

So what I would recommend is either trying multiple jest configs (one for local one for CI) or utilize the CI environment variable and have a jest config that reacts to the presence of this environment variable.

@johngrogg
Copy link
Author

@palmerj3 Ahh, that makes sense now. I hadn't seen anything in the jest documentation about that being eventually removed from Jest.

I also hadn't thought about using specific config files (I've just been using the package.json "jest" section). Thanks for the advice. You may want to update the documentation of this with a simple example of how to do what @sarod described above.

@mattbrictson
Copy link

Instead of

jest --ci --testResultsProcessor="jest-junit"

you can do this:

jest --ci --reporters=default --reporters=jest-junit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants