-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: graphql.visit is not a function #7348
Comments
i suffer same problem. |
@guiaramos This appears to be a known issue related to the In case you're wondering, reverting #7185 is not an option for the reasons I explained in #7185 (review). Both Just to be sure, though, what version of the |
@benjamn thanks for your reply. fully understand the point.
causes the following error: Details:
/Users/guilhermeramos/Desktop/projects.nosync/snuper/web/node_modules/graphql/graphql.mjs:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import isPromise from "./jsutils/isPromise.mjs";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (node_modules/@apollo/client/utilities/utilities.cjs.js:7:15)
"graphql": "15.4.0", I will create a reproduction soon and post here |
@guiaramos Did you fixed the issue? i get the same error running my tests, which work fine in the version before. The mentioned workaround
gives me the same SyntaxError
|
@zerocewl I was able to fix the issue by just pin the @apollo/client to version 3.2.4: |
@guiaramos Did you get a reproduction repo ready? |
Let us know if this is still a concern with |
This is still happening on |
@pulkit110 i have the same issue. Have you find a way to fix it? |
@paigekim29 I haven't been able to find a solution for this. Until this is resolved on Apollo, we are stuck with pinning to cc @hwillson I believe this is still a concern. |
Would someone mind trying things with |
Longer version: While trying to create a repo, I noticed that it doesn't happen on a brand new project. After some digging, it seems that I had a mock named I still think this is something that is caused by something that changed on Apollo (or a dependency) because the a custom mock nested inside a project should not interfere with the global Workaround for now: Check that you don't have any mocks named |
Thanks for the repro @pulkit110. I have a feeling this issue is being caused by |
Thanks for checking this out @hwillson. I tried without |
Deleting the mocks folder fixed it for me, thanks |
@pulkit110 We had a similar problem with webpack misresolving Are you using webpack? Do you have |
Hi @benjamn, thanks for the update. I have tried on the reproduction repository by turning off |
We had a few graphql.js files inside our folders with some our content, after renaming them the problem is gone. Thx @pulkit110 |
Same exact problem here. Could not find exported members from |
Intended outcome:
We are trying to mock the graphql for teting with jest on NextJS
Actual outcome:
We are getting the following error:
How to reproduce the issue:
Our files:
Task.test.tsx
test.tsx
AmIBossDocument
jest.config.js
jest.setup.js
tsconfig.jest.json
Versions
NextJS 9.4.0
The text was updated successfully, but these errors were encountered: