3.0.1 • Published 1 year ago

jest-transform-graphql2 v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

jest-transform-graphql

graphql-tag loader for Webpack 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.

Credits

I am forking and publishing this so it can be consumed in a project I'm working on, but full credit goes to alexcaza and remind101.