Skip to content
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

ci: take integration tests into account for front coverage #5976

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

multun
Copy link
Contributor

@multun multun commented Dec 1, 2023

At first I thought it would be fairly easy to have consistent code coverage for e2e tests and unit tests, but it's not:

  • unit tests are currently covered using v8's builtin code coverage, which is good, but does not work on all browsers. There is no build time instrumentation involved, just the js runtime doing the tracking.
  • the only way I found to instrument e2e tests is using istanbul, which instruments code at compile time. unfortunately, it does so using babel, which struggles processing the already transpiled js from react-swc
  • there's an swc plugin called swc-plugin-coverage-instrument which produces istanbul compatible instrumentation
  • if this plugin were to be used, vitest's istanbul support would have to skip instrumentation

Base problem

The same coverage system has to be used for both e2e tests and unit tests, so codecov can properly merge reports

Use istanbul everywhere

Pros:

  • better, more consistent coverage results

Cons:

  • complexity

Use v8 everywhere

This would only work on chrome, but is easier to get working, as it does not require build instrumentation

Pros:

  • easier to get working

Cons:

  • worse coverage results
  • only works on chrome / node

@multun multun requested review from a team as code owners December 1, 2023 19:52
@multun multun force-pushed the coverage-front-int branch 2 times, most recently from ea8c5da to 96f8285 Compare December 1, 2023 19:56
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d075d80) 16.04% compared to head (2a773f6) 45.97%.

Additional details and impacted files
@@              Coverage Diff              @@
##                dev    #5976       +/-   ##
=============================================
+ Coverage     16.04%   45.97%   +29.93%     
  Complexity     2117     2117               
=============================================
  Files           780      729       -51     
  Lines        101927    24048    -77879     
  Branches       2665     4696     +2031     
=============================================
- Hits          16351    11057     -5294     
+ Misses        84003    12105    -71898     
+ Partials       1573      886      -687     
Flag Coverage Δ
core 79.01% <ø> (ø)
front 19.35% <ø> (+10.92%) ⬆️
gateway 2.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@multun multun marked this pull request as draft December 1, 2023 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant