【发布时间】:2015-11-18 21:15:12
【问题描述】:
我一直在使用 proxyquire 来存根子组件和存储,但遇到了包含在 react-dnd 上下文中的组件的 Invariant Violation。
警告:上下文类型失败:所需的上下文 dragDropManager 未在 DragSource(Card) 中指定。 错误:不变违规:在 Card 的上下文中找不到拖放管理器。确保使用 DragDropContext 包装应用程序的顶级组件。阅读更多:http://gaearon.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context
我整理了一个 repo 来演示错误:见https://github.com/cmelion/react-hot-boilerplate/tree/Invariant-Violation-DND
运行它执行
npm install
npm test
【问题讨论】:
-
Dan Abramov @gaearon 能够为我指明正确的方向。已使用有效配置更新了 repo。
标签: reactjs proxyquire