In packages/react-scripts/scripts/utils/createJestConfig.js the transform config block contains a pattern to use fileTransform. The regex for that block of code is a catch all for extensions not referenced. Though graphql and gql have there own pattern which intends to use the jest-transform-graphql module, that pattern is not used because of the aforementioned catch all. This PR simply adds those extensions to allow them to be caught by the intended loader.
I should also note that in create-react-app on the next branch, there is a commit which does something very similar to the zeal block for graphql files. However in the mean time, graphql loading for jest is not working, in that a graphql file loaded in jest is converted to a stringified name via the fileTransform
In
packages/react-scripts/scripts/utils/createJestConfig.js
the transform config block contains a pattern to usefileTransform
. The regex for that block of code is a catch all for extensions not referenced. Thoughgraphql
andgql
have there own pattern which intends to use thejest-transform-graphql
module, that pattern is not used because of the aforementioned catch all. This PR simply adds those extensions to allow them to be caught by the intended loader.I should also note that in create-react-app on the next branch, there is a commit which does something very similar to the zeal block for
graphql
files. However in the mean time,graphql
loading for jest is not working, in that agraphql
file loaded in jest is converted to a stringified name via thefileTransform