Parrot-GraphQL is a helper library for creating GraphQL mocks used with Parrot, resolving both GET and POST requests to GraphQL endpoints. Version 5.3.0 wraps @graphql-tools/mock's mockServer to define mocking logic per schema type. It simplifies mocking GraphQL queries by allowing users to provide a schema string and custom mock resolvers, integrated seamlessly with Parrot's scenario-based testing. Released under American Express, it targets Node.js with CommonJS require syntax, though ESM may be available in newer versions. The library is ideal for integration and end-to-end testing with GraphQL APIs.
npm install parrot-graphqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Parrot scenario that mocks a GraphQL endpoint with custom resolver logic using casual library.
Change 'const graphql = require("parrot-graphql");' to 'const { graphql } = require("parrot-graphql");'Install parrot separately: npm install parrot --save-dev
Ensure schema is a string, e.g., const schema = `type Query { hello: String }`;Provide mock resolvers per type, not per field (e.g., mocks.User = () => ({...})).Run npm install parrot-graphql --save-dev
Use const { graphql } = require('parrot-graphql');Ensure the schema is a string literal or template string.
Install @graphql-tools/mock: npm install @graphql-tools/mock --save-dev