ardatan / ardatan/graphql-import-node

Jest import looses doc.loc.source due to JSON.stringify

Open
#13 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
80
Forks
13
PR merge metrics
No merged PRs in 30d

Description

Per issue laid out in https://github.com/apollographql/graphql-tag/issues/115, stringifying gql DocumentNode loose doc.loc.source property since its not enumerable anymore.

Looking at the code, jest import utilizes stringification which makes it so the returned DocuemntNote encounters errors such as https://github.com/apollographql/graphql-tag/issues/64 when used with graphql-tag.

I'd recommend patching the jest code to apply the same/similar fix in https://github.com/apollographql/graphql-tag/pull/65 to address the issue.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the Jest import implementation and compare its JSON.stringify handling with the similar fix in graphql-tag PR #65. Reproduce the graphql-tag issue and verify that the imported DocumentNode retains doc.loc.source and no longer triggers the referenced errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript, nodejs
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.