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

Custom Jest config #43

Closed
ntharim opened this issue May 29, 2017 · 10 comments
Closed

Custom Jest config #43

ntharim opened this issue May 29, 2017 · 10 comments

Comments

@ntharim
Copy link

ntharim commented May 29, 2017

Is it possible to define custom Jest config, not just Webpack?

@timarney
Copy link
Owner

Not yet.

@timarney
Copy link
Owner

Looks like this was merged facebook/create-react-app#1830 with CRA 1.0.0 does that get you what you need?

@ntharim
Copy link
Author

ntharim commented May 30, 2017

That only works for a few options. Not all. You'd still need to eject to have full control over Jest config.

@nicmyers
Copy link

I am also looking for this feature, specifically the ability to overwrite 'transformIgnorePatterns' as it's currently excluding node_modules. transformIgnorePatterns is not one of the four allowable options you can overwrite within CRA 1.0+

@timarney
Copy link
Owner

I won't have any time soon to work on this but it makes sense for this project.

Would be ideal if the jest config could be setup like the others i.e. how the override works require.cache[require.resolve(webpackConfig)].exports.

https://github.com/timarney/react-app-rewired/blob/master/packages/react-app-rewired/scripts/build.js

@timarney
Copy link
Owner

@nicmyers @nthtran does this merged pull request help either of you?

#59

@ntharim
Copy link
Author

ntharim commented Jul 17, 2017

Yes I think this would solve it. Will test it out. Thanks @Gregoirevda and @timarney!

@Gregoirevda
Copy link
Contributor

Gregoirevda commented Jul 17, 2017

You're welcome! I've added a test repo that shows how it is used: https://github.com/Gregoirevda/react-app-rewired-jest-overwrite

Adding jest info in package.json will work now.

@nicholasc nicholasc mentioned this issue Jul 17, 2017
@nicholasc
Copy link
Contributor

The last merge broke my basic jest config in my package.json.

Here is the configuration I was using before 1.0.10 and that was working:

jest: {
  "collectCoverageFrom": [
    "src/**/*js,
    "!src/index.js",
    "!src/setupTests.js"
  ]
}

Since updating, I get the following error, yet my configuration clearly is using an array.

screen shot 2017-07-17 at 12 52 40 pm

This is causing the issue. The typeof of a variable will never be an array so arrays in the configuration will always be converted to objects.

I've submitted a PR to fix this #60

@timarney
Copy link
Owner

Going to close this - can open more specific issues as needed.

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

5 participants