当我运行纱线测试或纱线测试[文件名]时,我的所有组件都通过了测试。但是,当我使用 --coverage 标志运行测试时,出现以下错误,指向我创建的自定义渲染函数的包装器。自定义渲染函数或多或少是从react-testing-library文档中复制/粘贴的:https://testing-library.com/docs/react-testing-library/setup
到目前为止,我尝试过的以下命令均无效:yarn test --coverage、yarn test --coverage --watchAll=false、yarn test --collectCoverage、npm run test --coverage、npm run test --coverage --全部观看=假
错误:
Error: Uncaught [Error: Wrapper(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.]
82 | );
83 | };
> 84 | return rtlRender(ui, { wrapper: Wrapper, ...renderOptions });
| ^
85 | };
86 |
87 | const render = (ui: ReactElement, { store = createStore(appReducer, initialState as AppApiStore), …Run Code Online (Sandbox Code Playgroud)