Skip to content
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

Got error "Cannot destructure property 'instrument' of 'options' as it is undefined" when using with jest:27.0.4 #441

Open
sdumjahn opened this issue Jun 7, 2021 · 2 comments

Comments

@sdumjahn
Copy link

sdumjahn commented Jun 7, 2021

I have jest 27.0.4 and got the following error:

TypeError: Cannot destructure property 'instrument' of 'options' as it is undefined.

      at Object.getCacheKey (node_modules/fbjs-scripts/jest/createCacheKeyFunction.js:38:12)
      at ScriptTransformer._getCacheKey (./node_modules/@jest/transform/build/ScriptTransformer.js:280:41)
      at ScriptTransformer._getFileCachePath (./node_modules/@jest/transform/build/ScriptTransformer.js:351:27)
      at ScriptTransformer.transformSource (./node_modules/@jest/transform/build/ScriptTransformer.js:588:32)
      at ScriptTransformer._transformAndBuildScript (./node_modules/@jest/transform/build/ScriptTransformer.js:758:40)
      at ScriptTransformer.transform (./node_modules/@jest/transform/build/ScriptTransformer.js:815:19)

When visiting the changes made in jest 27.0, I found the following commit jestjs/jest@858c50b#diff-d656d5ec636ff72f9f481b12a586d4048922a9f8e42e31521ea6f071530f3882 .
In this commit they moved the 3rd parameter inside the options (which was the 4th parameter) and call the transformer with only 3 parameters.
Since the code expect to find the options in the 4th parameter, wich is not there anymore the value of options is undefined and lead to this error.

@eps1lon
Copy link

eps1lon commented Jun 25, 2021

Should be fixed by #408

@Elias-Graf
Copy link

Elias-Graf commented Feb 18, 2022

As far as I can see #408 was merged, and I'm still experiencing this issue with "jest": "^27.5.1". Although, curiously only in a single test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants