@apollo/utils.jest-graphql-ast-serializer
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

graphQLASTSerializer

For snapshot testing in graphql, seeing the printed document is a concise and human-readable approach to validating AST objects. Installing this serializer means that all GraphQL document ASTs will be printed into the snapshot using the graphql-js print function rather than printing out the entire AST object (which would be the default behavior).

You can use it in your test files like so:

import graphQLASTSerializer from "@apollo/utils.jest-graphql-ast-serializer";

expect.addSnapshotSerializer(graphQLASTSerializer);

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @apollo/utils.jest-graphql-ast-serializer

      Weekly Downloads

      1

      Version

      3.0.0

      License

      MIT

      Unpacked Size

      4.99 kB

      Total Files

      10

      Last publish

      Collaborators

      • dkuc
      • glasser
      • trevor.scheer
      • apollo-bot