graphql-mocks

Declarative Mocking for GraphQL APIs

  • 💪 Mock and Prototype GraphQL APIs

    This library provides the tools to create mock GraphQL APIs or prototype on GraphQL Schema changes that might not exist yet. Use your mock GraphQL API in the browser or with any GraphQL API consumer.

  • 🧑‍🎨 Create Declarative Abstractions

    Use Highlight, Resolver Wrappers and Resolver Map Middlewares to create and compose declarative abstractions. This makes it easier to paint a picture of your Mock API in the perfect state, ready to tweak and iterate.

  • 🧑‍🔬 Test better

    graphql-mocks is aimed to helping you test better, too. Whether you want to log what is happening in your queries during local development, spy on your Resolvers with Sinon JS, or assert against state from running queries against the handler, graphql-mocks helps make it easier.

  • 👀 Take a look!

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

    • Setting up a GraphQL query handler and making a query
    • Using the @graphql-mocks/mirage package and its middleware to mock 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
    ⚠️ Warning: No servers are harmed, or used, in the resolving of these GraphQL queries
    GraphiQL
    Query Variables