Closed fengxinhhh closed 2 years ago
The shallow api in the same file can work correctly, but the mount api cant. It also can work correctly in github action env. include the mount and shallow api.
The mount
api requires a DOM.
Why is the dom not recognized, the Button component in the case works fine, I have no way of knowing why.
Will it be related to the version number? This happened after I configured eslint for my project.
It shouldn't be related to eslint at all.
What I do see is that you're using "react-dom@16.14.0_react@18.2.0" which suggests you're using overrides to make react 18 work - enzyme does not yet support react > 16.
The problem is found, and it is found that react18 will be automatically installed when downloading enzyme, which leads to this problem. Thank you for your help.
It shouldn't be automatically installed - only react 16 should be automatically installed since it's a peer dep of the react 16 adapter.
Since you're using pnpm, it may be a pnpm issue - i'd suggest trying with regular npm to see if that's the problem.
Answered, so closing.
Current behavior
Returns
Your environment
macos
API
Version
Adapter