I recently converted a create-react-app project to ReasonReact, and testing is the one part that I can’t seem to get right. CRA’s Jest configuration doesn’t play nicely with Reason, and I keep running against walls when I try to roll my own Jest config.
CRA’s Jest seems to have problems with (at least) two Reason conventions in particular: 1) keeping your __tests__
directory outside of your src
directory, and 2) applying Babel transforms to Bucklescript libraries in node_modules
(I’m using ES6).
There may be other issues too, but that’s as far as I’ve gotten at this point.
I’m sure I can’t be the only person who’s had to deal with this. Is this a solved problem? How have other people handled it?
I would rather not eject if I can help it. I’m very happy with the CRA Webpack setup, and I don’t want to have to maintain it myself. I wonder if using something like react-app-rewired is what I need. I’ve never had to configure Jest myself until now, so I’m not sure what I should be looking for.