Jest Plugin to load and parse imported GraphQL files
npm install @graphql-tools/jest-transformA Jest transformer to preprocess GraphQL Documents (operations, fragments and SDL)
yarn add @graphql-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)$': '@graphql-tools/jest-transform'
}
}
> How is it different from jest-transform-graphql? It doesn't use graphql-tag/loader under the@graphql-tools/webpack-loader
> hood but our own, more optimized and customisable .
- noDescription (_default: false_) - removes descriptions
- esModule (_default: false_) - uses import and export statements instead of CommonJS
`json``
{
"globals": {
"graphql": {
"noDescription": true
}
}
}