【发布时间】:2017-11-23 20:01:51
【问题描述】:
I wrote a decorator simplify smart/dumb components separation in ReactJS,有一次我试图将测试代码分成多个文件并移动了colaborator classes to the __mocks__ directory。
文件结构变成:
src
__mocks__
SharedComponent.js
SomeComponent.js
SomePresenter.js
SpecificPresenter.js
__tests__
index.js
index.js
在测试文件index.js中,加载SomeComponent我这样做:
import SomeComponent from 'SomeComponent'
该类仅存在于 mocks 目录中,它仅用于测试装饰器。 You can see here 我并没有在 manual says that auto mocking is disabled by default. 中明确地嘲笑该类
即使禁用自动模拟,jest 是否会自动模拟缺少依赖项?
【问题讨论】:
标签: reactjs decorator jestjs enzyme