We are using create-react-app to build our declarative framework. In this framework, we author a json file which gets loaded into a react-component by webpack. We have authored specific loader for that. This works well in the browser. But facing issues with unit testing. Create-react-app uses Jest for unit testing. What I want to acheive is transform these json files in js or react component, but hitting following limitations
- If I add custom transform for json, then it does not work due to restriction put up by jest-runtime. Post transformation, it expects the output to be json only. See Jest-runtime code which restricts
- If I rename file extensions to '.vm' then it never picks up my transformer as create-react-app add fileTransformer in following cases. The highlighted transformer gets picked up for all other types mentioned in that regex.
Need your guidance to resolve this issue.