3.0.0 • Published 1 year ago

@apollo/utils.jest-graphql-ast-serializer v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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);