-
Notifications
You must be signed in to change notification settings - Fork 128
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃帹 [RUM-262] Move view metrics in dedicated files #2386
馃帹 [RUM-262] Move view metrics in dedicated files #2386
Conversation
Should we do something with |
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.
It seems you replaced the tests from this file with the test suite that was in trackViewMetrics.spec.ts
. So, this spec file is not about trackViewEventCounts
anymore: it's a higher level test suite that actually test the behavior of trackViewMetrics
(actually, trackViews
, since trackViewMetrics
isn't used directly either).
I don't think that's a good idea. Spec files should be about testing the corresponding module, not a higher level module, else we won't have unit tests anymore and only integration tests.
I understand that it was already the case in the previous trackViewMetrics.spec.ts
where trackViews
was used (via setupViewTest
) instead of trackViewMetrics
, which isn't great, but I still think this PR shouldn't remove real unit tests.
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.
Yes, the problem you describe is true for all the new viewMetrics/* modules.
While I agree on the fact that spec files should be about testing the corresponding module in this case it would mean rewriting lots of tests. This PR was more about readability and discoverability, so I'm wondering if revisiting these tests will bring much value for now. Wdyt?
Also about trackViewEventCounts original tests, to me it has a strange level of testing because it's mainly a wrapper around trackEventCounts which already has unit tests. So in that sens it could already be considered has integration tests which is why I merged it with the tests in trackViewMetrics.spec.ts
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.
Yes, the problem you describe is true for all the new viewMetrics/* modules. While I agree on the fact that spec files should be about testing the corresponding module in this case it would mean rewriting lots of tests. This PR was more about readability and discoverability, so I'm wondering if revisiting these tests will bring much value for now. Wdyt?
I agree, this is not the place or the time to change the tests :) my concern was more about removed tests
Also about trackViewEventCounts original tests, to me it has a strange level of testing because it's mainly a wrapper around trackEventCounts which already has unit tests. So in that sens it could already be considered has integration tests which is why I merged it with the tests in trackViewMetrics.spec.ts
I don't agree,trackViewEventCounts
tests were specifically testing trackViewEventCounts
logic (increment when receiving an event related to the view, don't increment when it's not related to the view, delayed stop)
5319186
to
34648f0
Compare
d7681fd
to
c0e83a7
Compare
Codecov Report
@@ Coverage Diff @@
## main #2386 +/- ##
==========================================
- Coverage 93.91% 93.89% -0.02%
==========================================
Files 212 219 +7
Lines 6312 6311 -1
Branches 1405 1405
==========================================
- Hits 5928 5926 -2
- Misses 384 385 +1
... and 1 file with indirect coverage changes 馃摚 We鈥檙e building smart automated test selection to slash your CI/CD build times. Learn more |
698fcd4
to
0fa717b
Compare
Motivation
Isolate each view metrics and initial view timings in a dedicated file for easier maintenance and discoverability
Changes
Testing
I have gone over the contributing documentation.