tim*_*mhi 5 reactjs react-testing-library
我无法理解行为和用户事件的需求。我已阅读此问题和链接的博客文章,但这不完全是我的情况https://github.com/testing-library/user-event/issues/497 这不会产生任何警告:
等待行为(async()=>等待用户.键盘(“{Enter}”));
但这会导致生成以下警告:
等待 act(async () => 等待 user.hover(等待 screen.findByLabelText("连接目标")));
console.error
Warning: The current testing environment is not configured to support act(...)
at printWarning (node_modules/react-dom/cjs/react-dom.development.js:86:30)
at error (node_modules/react-dom/cjs/react-dom.development.js:60:7)
at isConcurrentActEnvironment (node_modules/react-dom/cjs/react-dom.development.js:25260:7)
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom.development.js:27559:12)
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom.development.js:25508:5)
at Object.enqueueSetState (node_modules/react-dom/cjs/react-dom.development.js:14067:7)
at List.setState (node_modules/react/cjs/react.development.js:354:16)
at call (node_modules/react-window/src/createListComponent.js:646:12)
at tick (node_modules/react-window/src/timer.js:26:16)
at runAnimationFrameCallbacks (node_modules/jsdom/lib/jsdom/browser/Window.js:599:13)
at Timeout.<anonymous> (node_modules/jsdom/lib/jsdom/browser/Window.js:577:11)
Run Code Online (Sandbox Code Playgroud)
我可以删除产生警告的行为,并且测试保持绿色,但我不想因为我的更改而遇到误报。
| 归档时间: |
|
| 查看次数: |
618 次 |
| 最近记录: |