-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Track stats for automatic block conversion #2205
Conversation
webpack.config.js
Outdated
'utils', | ||
'components', |
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.
blocks
now depends on utils
, so utils
should be loaded first. Output from the script at #965:
'blocks' depends on 'components'
'blocks' depends on 'element'
'blocks' depends on 'i18n'
'blocks' depends on 'utils'
'components' depends on 'element'
'components' depends on 'i18n'
'components' depends on 'utils'
'editor' depends on 'blocks'
'editor' depends on 'components'
'editor' depends on 'date'
'editor' depends on 'element'
'editor' depends on 'i18n'
'editor' depends on 'utils'
Suggested load order:
element
i18n
utils
components
blocks
date
editor
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.
I think the order is defined by the dependencies definition in the PHP side, isn't it?
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.
At one point, this was important to get right in the webpack config because otherwise it would break the test build. It seems this is no longer the case since we moved to Jest. I'll update accordingly.
5e41ea8
to
a54a6f1
Compare
return { | ||
bumpStat, | ||
}; | ||
}, |
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.
This needs a better solution (probably a higher-order component), but it was the easiest way I could think of to allow mocking the bumpStat
function.
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.
Can't we use jest.mock
? this feels weird.
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.
Well, so does jest.mock
😄
I'll try it again though.
8b4fc4e
to
f2bcfde
Compare
Codecov Report
@@ Coverage Diff @@
## master #2205 +/- ##
=========================================
+ Coverage 23.83% 24.24% +0.4%
=========================================
Files 142 142
Lines 4459 4459
Branches 756 756
=========================================
+ Hits 1063 1081 +18
+ Misses 2866 2853 -13
+ Partials 530 525 -5
Continue to review full report at Codecov.
|
c817e67
to
9f98969
Compare
This reverts commit f93e5d7.
@youknowriad you can see my attempts above at getting Jest mocking to work for testing the call to Maybe we should switch to |
tracking.bumpStat = jest.fn(); | ||
document.addEventListener = jest.fn( ( event, cb ) => { | ||
eventMap[ event ] = cb; | ||
} ); |
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.
This approach is from enzymejs/enzyme#426 (comment).
…e_video_to_5.0.2 Update react-native-video to version 5.0.2
Follow-up to #2135. That PR uses a technique which we should probably try to avoid unless absolutely necessary: transparently converting one block type into another when loading a post.
Let's track how often this happens to get more understanding of how it behaves in real-world usage.
This requires moving stat tracking out of the
editor
module and into theutils
module because otherwise this change would create a circular dependency (blocks → editor → blocks
). See previous discussion at #2140 (comment).