Skip to content

Getting started

GraphQL Testing Library provides utilities for creating Mock Service Worker (MSW) request handlers for GraphQL APIs.

This guide will help you get started with MSW, create a request handler using a GraphQL schema and begin writing tests that can run in Node.js, the browser or React Native.

Installation

GraphQL Testing Library has peerDependencies listings for msw at ^2.0.0 and graphql at ^15.0.0 || ^16.0.0.

Install them along with this library using your preferred package manager:

Terminal window
npm install --save-dev @apollo/graphql-testing-library msw graphql