-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
add preact snapshot test #1267
Comments
@yesmeck 其实单测可不可以这样写: import React from '../shared/ReactOrPreact';
... // ReactOrPreact
export default (function () {
if (ENV === 'xxx') {
return Preact
}
return React
})(); 这样无论 Snapshot 还是单测都可以同时测试 Preact 和 React |
应该可以把 React mock 掉,http://facebook.github.io/jest/docs/en/manual-mocks.html#content 在 Mock 里判断用哪个版本的 React |
但是需要 React 和 Preact 生成的 snapshot 一致。 |
i will try this first https://github.com/ruyadorno/preact-jest-snapshot-test-boilerplate |
snapshot 跑通了,#1306 还剩一个问题是 jest-serializer-html-string 没有把 html 元素的属性换行排列,所以与 react snaoshot 不一致,这个抽空过去 PR fix 掉。 |
preact, inferno, react-lite 几个库跑 react 官方用例: |
preactjs/preact#560
preactjs/preact-render-to-string#16
enzymejs/enzyme#742
The text was updated successfully, but these errors were encountered: