https://github.com/remind101/jest-transform-graphql
Make .graphql file importing work in Jest
https://github.com/remind101/jest-transform-graphql
Last synced: over 1 year ago
JSON representation
Make .graphql file importing work in Jest
- Host: GitHub
- URL: https://github.com/remind101/jest-transform-graphql
- Owner: remind101
- License: mit
- Created: 2016-12-16T02:04:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-05-13T19:47:49.000Z (about 4 years ago)
- Last Synced: 2025-04-01T11:04:22.217Z (over 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 122
- Watchers: 10
- Forks: 24
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jest-transform-graphql
[`graphql-tag` loader for Webpack](http://dev.apollodata.com/react/webpack.html) lets you keep GraphQL queries in separate files.
This lib makes those work in Jest.
## Usage
In your package.json,
```
"jest": {
"transform": {
"\\.(gql|graphql)$": "jest-transform-graphql",
".*": "babel-jest"
}
}
```
You have to include the `.*` matcher because once you define the `transform` property, it overrides that default.
For more on configuring Jest mappers, see Jest's [Webpack tutorial](https://facebook.github.io/jest/docs/tutorial-webpack.html).