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

fix(plugin-coverage): merge multiple results for a file #688

Merged
merged 2 commits into from
May 30, 2024

Conversation

Tlacenka
Copy link
Collaborator

Closes #560
Fixes part of #647

In this PR, I implement a merging logic in order to collect coverage for the same file system from multiple test suites:

  • In case different coverage runs identify different branches of code/functions, all that are identified by any tool are registered.
  • The hits of functions, branches and lines are merged. As long as a function, branch or line is covered by at least one test suite, it is considered covered.

Tested on our CLI + unit tested.

@Tlacenka Tlacenka requested review from vmasek and matejchalk May 29, 2024 15:00
@Tlacenka Tlacenka self-assigned this May 29, 2024
@github-actions github-actions bot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🧩 coverage-plugin labels May 29, 2024
Copy link

nx-cloud bot commented May 29, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1eecaae. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 6 targets

Sent with 💌 from NxCloud.

Copy link

github-actions bot commented May 29, 2024

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared target commit 78ea50b with source commit 37b3283.

🏷️ Categories

🏷️ Category ⭐ Current score ⭐ Previous score 🔄 Score change
Code coverage 🟡 80 🟡 70 ↑ +10
Performance 🟢 93 🟡 86 ↑ +6.8
Accessibility 🟢 98 🟢 100 ↓ −1.8
Best Practices 🟢 100 🟢 100
SEO 🟡 86 🟡 86
PWA 🟡 63 🟡 63
Bug prevention 🟢 100 🟢 100
Code style 🟢 99 🟢 99
Security 🟢 95 🟢 95
Updates 🟢 93 🟢 93
Custom checks 🟡 67 🟡 67

🗃️ Groups

👍 2 groups improved, 👎 1 group regressed
🔌 Plugin 🗃️ Group ⭐ Current score ⭐ Previous score 🔄 Score change
Code coverage Code coverage metrics 🟡 80 🟡 70 ↑ +10
Lighthouse Performance 🟢 93 🟡 86 ↑ +6.8
Lighthouse Accessibility 🟢 98 🟢 100 ↓ −1.8

18 other groups are unchanged.

🛡️ Audits

👍 9 audits improved, 👎 1 audit regressed, 11 audits changed without impacting score
🔌 Plugin 🛡️ Audit 📏 Current value 📏 Previous value 🔄 Value change
Lighthouse Largest Contentful Paint element 🟩 2,040 ms 🟥 2,750 ms  −∞ %
Lighthouse Background and foreground colors have a sufficient contrast ratio 🟥 0 🟩 0  −∞ %
Code coverage Line coverage 🟩 91 % 🟨 66 % ↑ +38 %
Lighthouse Max Potential First Input Delay 🟥 260 ms 🟥 370 ms ↓ −30 %
Lighthouse Largest Contentful Paint 🟩 2.0 s 🟨 2.7 s ↓ −26 %
Code coverage Function coverage 🟨 76 % 🟨 64 % ↑ +19 %
Lighthouse Total Blocking Time 🟩 120 ms 🟨 230 ms ↓ −48 %
Code coverage Branch coverage 🟨 83 % 🟨 82 % ↑ +1 %
Lighthouse Time to Interactive 🟩 2.6 s 🟩 2.7 s ↓ −3 %
Lighthouse Cumulative Layout Shift 🟨 0.147 🟨 0.148  −∞ %
Lighthouse Minimizes main-thread work 🟥 2.5 s 🟥 3.1 s ↓ −20 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 432 KiB 🟩 Total size was 432 KiB ↓ +0 %
Lighthouse Speed Index 🟩 1.6 s 🟩 1.5 s ↑ +12 %
Lighthouse Uses efficient cache policy on static assets 🟨 11 resources found 🟨 11 resources found ↓ +0 %
Lighthouse First Meaningful Paint 🟩 1.1 s 🟩 1.3 s ↓ −12 %
Lighthouse Metrics 🟩 2600 🟩 2671 ↓ −3 %
Lighthouse First Contentful Paint 🟩 1.1 s 🟩 1.1 s ↑ +2 %
Lighthouse JavaScript execution time 🟩 0.1 s 🟩 0.1 s ↓ −20 %
Lighthouse Initial server response time was short 🟩 Root document took 0 ms 🟩 Root document took 10 ms ↓ −50 %
Lighthouse Network Round Trip Times 🟩 10 ms 🟩 0 ms ↑ +150 %
Lighthouse Server Backend Latencies 🟩 10 ms 🟩 10 ms ↑ +43 %

501 other audits are unchanged.

BioPhoton
BioPhoton previously approved these changes May 29, 2024
Copy link
Collaborator

@BioPhoton BioPhoton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

matejchalk
matejchalk previously approved these changes May 29, 2024
Copy link
Collaborator

@matejchalk matejchalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great effort 👍

packages/plugin-coverage/src/lib/runner/lcov/merge-lcov.ts Outdated Show resolved Hide resolved
@Tlacenka Tlacenka dismissed stale reviews from matejchalk and BioPhoton via c385da8 May 30, 2024 08:50
@Tlacenka Tlacenka force-pushed the coverage-plugin/merge-results branch from 9b92076 to c385da8 Compare May 30, 2024 08:50
@Tlacenka Tlacenka requested a review from matejchalk May 30, 2024 08:51
matejchalk
matejchalk previously approved these changes May 30, 2024
@Tlacenka Tlacenka merged commit 4332b2a into main May 30, 2024
19 checks passed
@Tlacenka Tlacenka deleted the coverage-plugin/merge-results branch May 30, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧩 coverage-plugin 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coverage has significantly decreased after Nx update
3 participants