@graphql-tools/jest-transform
Version:
Jest Plugin to load and parse imported GraphQL files
47 lines (36 loc) • 866 B
Markdown
# GraphQL Jest Transform
A Jest transformer to preprocess GraphQL Documents (operations, fragments and SDL)
npm install -tools/jest-transform
In your `package.json`:
```json
{
"jest": {
"transform": {
"\\.(gql|graphql)$": "@graphql-tools/jest-transform"
}
}
}
```
or `jest.config.js`:
```js
module.exports = {
// ...
transform: {
'\\.(gql|graphql)$': '-tools/jest-transform'
}
}
```
> How is it different from `jest-transform-graphql`? It doesn't use `graphql-tag/loader` under the
> hood but our own, more optimized and customisable `-tools/webpack-loader`.
## Options
- noDescription (_default: false_) - removes descriptions
- esModule (_default: false_) - uses import and export statements instead of CommonJS
```json
{
"globals": {
"graphql": {
"noDescription": true
}
}
}
```