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

Added ability to configure Jest via package.json #1990

Closed
wants to merge 1 commit into from

Conversation

danjamin
Copy link

@danjamin danjamin commented Apr 17, 2017

  • works when NOT ejected by merging default and app Jest options
  • eject simply combines app and default into a single package.json jest field

fixes #1785

Verified against my own project via npm link commands. I added a jest config within my package.json, ran CI=true npm test and verified that it was using my extra configuration options. I also ejected locally to make sure that worked properly and it did, resulting in a package.json with the merged options in the jest field. I am open to advice on how else to test this feature.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

@danjamin danjamin changed the title Added ability to configure Jest via package.json (#1785) Added ability to configure Jest via package.json Apr 17, 2017
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

- works when NOT ejected by merging default and app Jest options
- eject simply combines app and default into a single package.json jest field
@gaearon
Copy link
Contributor

gaearon commented May 16, 2017

It looks like #1830 was earlier so I’ll build on top of that.
Thanks for PR though!

@gaearon gaearon closed this May 16, 2017
@danjamin
Copy link
Author

@gaearon is there a plan in place / a PR in the works already to enable overriding of the testResultsProcessor? This is the option I personally would like to override in my projects. Should be as simple as adding it here.

@gaearon
Copy link
Contributor

gaearon commented May 17, 2017

I don’t think it’s a good idea to override it in Jest config—how would you run tests locally?
(I haven’t tried it so I don’t know.)

My impression is you should just pass it as an argument at CI, e.g.

  "test:ci": "react-scripts test -- --testResultsProcessor myprocessor

and then run that instead of npm test on CI.

@danjamin
Copy link
Author

@gaearon this approach worked! Thanks for the pointer. Quick thing though, I ended up doing this:

"test:ci": "react-scripts test --testResultsProcessor=jest-junit"

after installing jest-junit and configuring it separately.

@gaearon
Copy link
Contributor

gaearon commented May 18, 2017

Cool, thanks!

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

Successfully merging this pull request may close these issues.

allow setting of coverage reporters (or other jest config options)
3 participants