[BUG] @snowpack/app-scripts-react is not compatible with Jest 27.
See original GitHub issueBug Report Quick Checklist
- I am on the latest version of Snowpack & all plugins.
- I use package manager yarn
- I run Snowpack on OS Mac
- I run Snowpack on Node.js v12+
Describe the bug
@snowpack/app-scripts-react is not compatible with Jest 27.
TypeError: Cannot destructure property 'config' of 'cacheKeyOptions' as it is undefined.
at Object.getCacheKey (/Users/piotr/[...]/node_modules/@snowpack/app-scripts-react/node_modules/babel-jest/build/index.js:217:14)
at ScriptTransformer._getCacheKey (/Users/piotr/[...]/node_modules/@jest/transform/build/ScriptTransformer.js:280:41)
at ScriptTransformer._getFileCachePath (/Users/piotr/[...]/node_modules/@jest/transform/build/ScriptTransformer.js:351:27)
at ScriptTransformer.transformSource (/Users/piotr/[...]/node_modules/@jest/transform/build/ScriptTransformer.js:588:32)
at revertHook.exts (/Users/piotr/[...]/node_modules/@jest/transform/build/ScriptTransformer.js:864:18)
at Module._compile (/Users/piotr/[...]/node_modules/pirates/lib/index.js:93:29)
at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Object.newLoader (/Users/piotr/[...]/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
Looks like the babel-jest
dependency should be updated to 27.
Expected behavior
Tests cases should be executed.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:9
Top Results From Across the Web
[BUG] @snowpack/app-scripts-react is not compatible with ...
Describe the bug. @snowpack/app-scripts-react is not compatible with Jest 27. TypeError: Cannot destructure property 'config' of ' ...
Read more >Jest 27: New Defaults for Jest, 2021 edition
It has amassed well above a hundred comments, not even taking into ... we are now confident that jest-circus is highly compatible with ......
Read more >@testing-library/jest-dom - npm
This allows you to check whether an element is not disabled from the user's perspective. It works like not.toBeDisabled() . Use this matcher...
Read more >How To Fix Unexpected Token Error for NPM Package in react ...
Are you getting this error with react -leaflet or other packages. If you are then it's most likely related to babel and there...
Read more >React typescript snowpack - can't import .webp - Stack Overflow
It looks very promising but I get an error [@snowpack/plugin-typescript] Cannot find module '../../dummy.webp or its corresponding type ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So I’ve forked locally to figure out a fix, and the package needs a couple of changes to work. The
package.json
file needsbabel-jest
updating to v27.x as per @pusewicz 's suggestion. But it also needs thecreateTransformer
method updating (as per this issue in the Jest repo https://github.com/facebook/jest/issues/11444) which would look something like this:packages/app-scripts-react/jest/babelTransform.js
This is the correct fix,
jest
andbabel-jest
should follow the same major, ex27.x.x