GraphQL testing utility for generating mock data objects and operation mocks from your schema, with TypeScript types. Current stable version is 0.4.7, with weekly releases on npm. It combines generated types, patching mechanisms, and customizable transforms for common object variations. Key differentiators: built-in mock coverage assertions, array helpers like `next` and `last`, and a `MockedProvider` wrapper for Apollo Client with better stack traces, making it more comprehensive than simple faker-based mocks. Requires peer dependencies graphql, @graphql-tools/graphql-tag-pluck, react, @types/react, @apollo/client 3, @testing-library/dom, and @testing-library/react.
npm install graphql-data-generatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal setup to initialize a builder and build a User object with overrides.
Pin to current version and test upgrades thoroughly.
Install peer deps manually: npm install graphql @graphql-tools/graphql-tag-pluck react @types/react @apollo/client @testing-library/dom @testing-library/react
Call init as init(...)(() => ({...})) not init(...).Always import MockedProvider from 'graphql-data-generator' directly.
Run npm install graphql-data-generator --save-dev and ensure tsconfig.json includes node_modules types.
Use import { init } from 'graphql-data-generator' instead of import init from 'graphql-data-generator'.Ensure you've generated types via CLI and passed correct query/mutation/subscription/type/input objects to init.