-
Notifications
You must be signed in to change notification settings - Fork 32
Remove flow types from the npm distribution #37
Comments
I have also tried the |
Encountered the same problem. Does anybody have a solution yet? |
Is Babel in your mix? |
I'm using |
Solution
module.exports = {
jest: (config) => {
if (typeof config.plugins === 'undefined') {
config.plugins = [];
}
config.plugins.push('transform-flow-strip-types');
return config;
},
} Then the test works. |
@yookoala I tried your solution and still have this problem. |
@gabrielmoncea: I have never handled my own babel config in this project. I don't even have a babelrc. I am using the CRA default setup with only the changes I wrote in my last comment. Again, I only have problem when running test. There is no issue building or running test server. |
@yookoala weird. I tried w/ & w/o any babel config but still got this error |
@gabrielmoncea: What is the version of your CRA? |
My project initialised one year ago with |
@yookoala I just bootstrapped a new project with latest version of CRA and got the same test fail reason |
@gabrielmoncea I also couldn't get @yookoala fix to work. Ended up omitting this mock plugin and mocking just a bare object from this thread.
|
When I add mapbox-gl-js-mock to my project to a create-react-app project, I expect to be able to run unit tests that involve Mapbox types.
I add the mock as a dev dependency:
I then use it as a mock in my jest tests:
Finally, I see failing tests because the Flow type annotations confuse Jest.
Unfortunately, Jest does not apply transformations to files in
node_modules/
, so I don't see a good way around this issue shy of updating the mock to not have type annotations. Any configuration suggestions that solve the problem would be great.For what it's worth, the create-react-app typescript integration works just fine, but the workings of that are hidden in the react-scripts. After following the suggestions for enabling flow in create-react-app, I still have this issue.
The text was updated successfully, but these errors were encountered: