-
-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce jest and enzyme #136
Conversation
done(); | ||
}); | ||
}); | ||
|
||
it('should add css class of root dom node', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
像这种 DOM 结构是不是渲染正确的,直接用 snapshot 测试,可以省事很多,而且覆盖率也更高。
const input = TestUtils.findRenderedDOMComponentWithTag(instance, 'input'); | ||
); | ||
|
||
const input = wrapper.find('input'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enzyme 之于 React 就像 jQuery 之于 DOM,操作 Component 会简单很多。
coverage 怎么搞? |
jest 自带了的 |
可以,全部改了,改好我合并 |
注意 coveralls.io 能否正确运行 |
92d8380
to
2d49bb9
Compare
2d49bb9
to
7cab4d9
Compare
7cab4d9
to
6d572aa
Compare
这边已经把所有 expect 的写法都改了,具体测试现在用 jQuery 来写的地方我看情况后面补测试的时候再调整为 enzyme 和 snapshot。 coverage 的计算结果要比原来的低,暂时不知道为什么。 |
改完需要合并时通知 |
已经改完了,这个可以合并了。 我后面补的测试再另外 PR。 |
貌似不能 npm run chrome-test 浏览器中调试了...
能用么 |
这样是可以的:
这样有问题 jestjs/jest#1652
|
mocha 迁移到 jest 只要调整下 expect 的写法,这里只转换了一部分,看看行不行。
运行:
npm run jest