reactjs 在剧作家中,不能渲染以另一构件为道具的React构件

62lalag4  于 2022-11-04  发布在  React
关注(0)|答案(1)|浏览(110)

我有一个React组件,它将另一个组件作为道具,当我尝试在Playwright中渲染它时,我得到了一个错误。
第一个
我的期望是这个测试应该通过,因为它应该在MyComponent中呈现SubComponent。但是,它失败了,并出现错误:

undefined: Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=Component for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

       6 | test.describe('My Component', () => {
       7 |   test('it should render', async ({ mount, page }) => {
    >  8 |     const component = await mount(
         |                             ^
       9 |       <MyComponent SubComponent={TestSubComponent} />
      10 |     );
      11 |     await expect(component).toContainText('Hello');

React错误被缩小,所以很难判断出了什么问题。
有什么问题吗?

相关问题