-
Notifications
You must be signed in to change notification settings - Fork 25
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
Compatibility for Jest 28 #11
base: master
Are you sure you want to change the base?
Conversation
`jest-transform-graphql` module fails in Jest 18 with this error: ``` Invalid return value: `process()` or/and `processAsync()` method of code transformer found at "/Users/evhaus/Git/zenhub/node_modules/jest-transform-graphql/index.js" should return an object or a Promise resolving to an object. The object must have `code` property with a string of processed code. This error may be caused by a breaking change in Jest 28: https://jestjs.io/docs/upgrading-to-jest28#transformer Code Transformation Documentation: https://jestjs.io/docs/code-transformation ``` This is due to the change here: https://jestjs.io/docs/upgrading-to-jest28#transformer Unfortunately this PR will make `jest-transform-graphql` no longer compatible with Jest <=27, so it would need to be published a new major version change.
I think you mean Jest 28, but im having the same issue. |
Are you sure? I've tried installing this version to a private repo of mine still on jest 27.5.1, and the tests are still working for me. Could I be doing something wrong? |
Not at all. I assumed that because of the API syntax change older versions might not support it, but I'm happy to be wrong here. I do suspect though that not all older versions of Jest will support it. It's good that 27 does but what about 26, 25, 24? I haven't tested to see where it falls apart. |
That's fair. Better safe than sorry to mention that for sure. I did some quick digging and it looks like according to the types definition file at least, Looks like support for returning a |
any update on this? |
for anyone waiting for this to be merged - you can just put the contents of transform: {
'\\.(gql|graphql)$': './src/utils/gqlTransformer',
'\\.[jt]sx?$': 'babel-jest'
} |
This change should be good, but I guess the project is no longer maintained. |
It would be great if the maintainer released this. Solves issue #13 |
Has anyone managed to get this fix working with TypeScript, Apollo, and Jest 29? I've implemented this change to the
At the point that the GraphQL is used in my client code, for example:
Any thoughts would be appreciated, I've already lost 4 hours :D |
jest-transform-graphql
module fails in Jest 28 with this error:This is due to the change here: https://jestjs.io/docs/upgrading-to-jest28#transformer
Unfortunately this PR will make
jest-transform-graphql
no longer compatible with Jest <=27, so it would need to be published a new major version change.You can test this PR by installing it your project via this npm dependency definition: