question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi.

I’ve managed to use this in my project at runtime, however when running my tests with jest I get

({“Object.<anonymous>”:function(module,exports,require,__dirname,__filename,global,jest){mutation loginUser($emailAddress: String!, $password: String!, $deviceToken: String!) {

SyntaxError: Unexpected identifier

Tried using https://github.com/keplersj/jest-raw-loader but didn’t work either as I believe that just imports the file as a string and this plugin passes it through graphql-tag first, and I instead receive

Invariant Violation: Argument of undefined passed to parser was not a valid GraphQL DocumentNode. You may need to use ‘graphql-tag’ or another method to convert your operation into a document

Is there a way to transform files in jest the same way this plugin does at runtime?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danilobuergercommented, Jun 30, 2018
1reaction
Slessicommented, Apr 19, 2018

10/10 for enthusiasm :p

Currently I’ve stopped trying to fix my original use case to work, I just transpile first and test the outputted JS. I do however like the sound of requireGql, and would like give it a try when ready 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest · Delightful JavaScript Testing
Jest is a JavaScript testing framework designed to ensure correctness of any JavaScript codebase. It allows you to write tests with an approachable,...
Read more >
Jest Tutorial for Beginners: Getting Started With JavaScript ...
Jest is a JavaScript test runner, that is, a JavaScript library for creating, running, and structuring tests. Jest ships as an NPM package,...
Read more >
Jest Tutorial - JavaScript Unit Testing Using Jest Framework
In this Jest tutorial, we will learn about various Jest features, Jest matchers and how to use Jest framework for JavaScript Unit Testing....
Read more >
Jest Testing Tutorial: 5 Easy Steps - Testim Blog
Jest offers code coverage out of the box through its CLI—just use the –coverage option or the collectCoverage property in the Jest configuration ......
Read more >
Jest testing: Top features and how to use them - LogRocket Blog
Jest is a JavaScript testing framework built by Facebook and primarily designed for React-based applications, but is also used with Babel, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found