Testing React: Target Container is not a DOM element

前端 未结 5 920
悲哀的现实
悲哀的现实 2020-12-16 09:27

I\'m attempting to test a React component with Jest/Enzyme while using Webpack.

I have a very simple test @

import React from \'react\';
import { sha         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 10:06

    Make sure in your test file you have well imported the render component. It should be imported from @testing-library/react not from react-dom:

    import { render } from '@testing-library/react';
    

提交回复
热议问题