1

I have a React app with:

  • react-app-rewired
  • Apollo Client 3.5.5

I have an error when I try to use this import:

import { MockedProvider } from '@apollo/client/testing';

If I do console.log(MockedProvider) I got: undefined.

If in my jest config I add this:

"transformIgnorePatterns": ["<rootDir>/node_modules/.*"]

It works and I got the proper console.log: [Function: MockedProvider] { defaultProps: { addTypename: true } }

That's fine, yes, but I'm getting errors in other partes of the app, like:

SyntaxError: Invalid or unexpected token

  4 | import Loader from 'react-loaders';
  5 |
> 6 | import 'loaders.css/loaders.css';

So, what could I do?

I don't get how to apply that only for Apollo Client.

pmiranda
  • 7,602
  • 14
  • 72
  • 155

0 Answers0