graphql-mocks

Tools for declaratively mocking GraphQL APIs

Highlight

Use Highlight to flexibly select parts of the schema to operate on

Mock

Mock resolvers and resolver maps using wrappers and middlewares to cover various scenarios

Store

Persist mutations and control stateful data with a graphql-paper in-memory store

Demo

⚠️ Warning: No servers are used, or harmed, in the resolving of these GraphQL queries

To quickly show a few of the features in action here we have:

  • Setting up a GraphQL query handler and making a query
  • Using graphql-paper package, an in-memory graphql store, which allows stateful queries (try a mutation and see the change persist in subsequent queries)
  • An embedded logWrapper highlighted on all root-level Query resolvers for logging

Go ahead and do a few queries and mutations (see changes persist)

GraphiQL
Query Variables

The Code