You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project we are in the process of migrating tests from enzyme to testing-library, currently we have both of them in the project while we migrate the tests on a one-by-one basis. Both of these libraries define the toBeChecked (and many other duplicated expect extension). Before #11949 we were able to control which of these should take precedence by setting the order of imports. The PR mentioned above changed the code so it is now uses Object.defineProperty to add extensions to the expect object without the configurable property set.
● Test suite failed to run
TypeError: Cannot redefine property: toBeChecked
at Function.defineProperty (<anonymous>)
at node_modules/expect/build/jestMatchersObject.js:103:14
at Array.forEach (<anonymous>)
Expected behavior
Jest doesn't fail when loading expect extensions with conflicting names.
Actual behavior
Jest fails when loading expect extensions with conflicting names.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
27.3.0
Steps to reproduce
In my project we are in the process of migrating tests from enzyme to testing-library, currently we have both of them in the project while we migrate the tests on a one-by-one basis. Both of these libraries define the
toBeChecked
(and many other duplicated expect extension). Before #11949 we were able to control which of these should take precedence by setting the order of imports. The PR mentioned above changed the code so it is now usesObject.defineProperty
to add extensions to theexpect
object without theconfigurable
property set.Clone my repo: https://github.com/blaky/jest-issue
npm ci
npm test
The error you'll see:
Expected behavior
Jest doesn't fail when loading expect extensions with conflicting names.
Actual behavior
Jest fails when loading expect extensions with conflicting names.
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: