Invalid return value: `process()` or/and `processAsync()` method of code transformer found at "..." should return an object or a Promise resolving to an object.
Alwinator opened this issue · comments
After updating from jest 27 to jest 28.1.0 all tests fail with the following exception:
FAIL test-suite/tests/app-get.e2e-spec.ts
● Test suite failed to run
● Invalid return value:
`process()` or/and `processAsync()` method of code transformer found at
"/home/alwin/WebStormsProjects/myproject/node_modules/ts-jest/dist/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
at ScriptTransformer._buildTransformResult (../node_modules/@jest/transform/build/ScriptTransformer.js:507:15)
at ScriptTransformer.transformSource (../node_modules/@jest/transform/build/ScriptTransformer.js:628:17)
at ScriptTransformer._transformAndBuildScript (../node_modules/@jest/transform/build/ScriptTransformer.js:765:40)
at ScriptTransformer.transform (../node_modules/@jest/transform/build/ScriptTransformer.js:822:19)
@Alwinator Please try following command for me it works.
yarn add ts-jest@next
@bhagat-singh001 Indeed! I had ts-jest still on version 27, updating it to 28.0.3 fixed the issue!
I have jest 29.6.1 version and react-scripts:5.0.1 still throws same eror , any help would be appreciated
@poojaSivakumar97 is this solved for you
@poojaSivakumar97 if it had got solved for you, could you share me how it had got solved
Just posting here as a heads up to anyone else still struggling with this, I solved this by ensuring I had installed the same version number of jest-environment-jsdom
as jest
, and added set the testEnvironment
option to jsdom