Not compatible with jest 27
See original GitHub issue@testing-library/dom
version: 7.31.0- Testing Framework and version: Jest 27.0.1
- DOM Environment: jsdom: 16.6
What you did:
After upgrading to jest v27 I get an error:
● Test suite failed to run
TypeError: Cannot destructure property 'DOMElement' of '_prettyFormat.default.plugins' as it is undefined.
at Object.<anonymous> (node_modules/@testing-library/dom/dist/pretty-dom.js:33:3)
at Object.<anonymous> (node_modules/@testing-library/dom/dist/config.js:11:18)
Problem description:
I believe jest’s pretty-format package changed from exporting on “default” to exporting directly. Even though dom testing library requires a older version, jest requires the newer version, so when dom testing library requires it, it gets the newer version…
Suggested solution:
I can only think to publish a new major version which will not be compatible with jest 26 but will work with jest 27. I believe you just need to remove .default
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:24
- Comments:9 (2 by maintainers)
Top Results From Across the Web
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 >ts-jest - npm
ts-jest. A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript. NPM version NPM downloads ......
Read more >Stencil: Jest 27 Upgrade Instructions - Ionic Blog
Stencil v2.13.0 includes support for Jest v27, but does not require any project to ... backwards compatibility between older versions of Jest and...
Read more >does not export a "getVmContext" method, which is mandatory ...
does not export a "getVmContext" method, which is mandatory from Jest 27. This method is a replacement for "runScript" · node.js · unit-testing ......
Read more >Jest 27.x: Wrong results with jest test.each : WEB-54816
WEB-51316 Jest 27, each() tests with variable interpolation: tests not represented in UI when running individual tests.
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 Free
Top 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
It doesn’t work for me. I’m running
@testing-library/dom
8.1.0 andjest
27.0.6`.See multiple
TypeError: Cannot destructure property 'AsymmetricMatcher' of '_prettyFormat.default.plugins' as it is undefined.
warnings on my tests.I found a workaround: uninstall
@types/jest
, delete your package-lock.json, re-install.The problem is that
jest-diff@26.x
uses an incompatible version ofpretty-format
. For some reason,@types/jest
depends onjest-diff@26.x
(https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/jest/package.json#L4-L5). And for another reason, when you run jest with an npm script, jest usesjest-diff@26
from@types/jest
which uses the old, incompatiblepretty-format
, even if you’ve installedpretty-format
andjest-diff@27
as top level dependencies!