[FOLIO-2703] look into handling multiple lcov.info reports in js builds Created: 27/Jul/20  Updated: 19/Aug/20  Resolved: 10/Aug/20

Status: Closed
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: New Feature Priority: TBD
Reporter: Ian Hardy Assignee: Ian Hardy
Resolution: Done Votes: 0
Labels: devops-backlog, testing
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Relates
relates to UIDATIMP-586 SPIKE: Investigate new testing approa... Closed
Sprint: DevOps: sprint 94
Development Team: FOLIO DevOps

 Description   

With some teams using bigtest and Jest to generate lcov reports. Look into if its possible for Sonar to read two reports.

See: https://github.com/folio-org/ui-data-import/pull/632

both BigTest and Jest are creating lcov.info reports. Can Sonar take them both?



 Comments   
Comment by Ian Hardy [ 29/Jul/20 ]

Hi Mariia Aloshyna, We'll give this a try. A few questions:

  • is the goal to have a combined report, or two separate reports, one from each test suite?
  • Can you recreate the test on a branch where BigTest publishes to artifacts/coverage and Jest publishes to coverage? I'd like to do some testing and see what if anything we can come up with.

Thanks,

Ian

Comment by Mariia Aloshyna [ 29/Jul/20 ]

Hi Ian Hardy!
1. The goal is to have a combined report.
2. Ok, I'll send you a link to a branch once I create it.
Thank you!

Comment by Ian Hardy [ 29/Jul/20 ]

branch for working on combing reports (thanks!): https://github.com/folio-org/ui-data-import/tree/coverage-report-test

Comment by Ian Hardy [ 03/Aug/20 ]

Hi Mariia Aloshyna, How can I tell whether or not the Jest test is getting picked up? I see both reports in the workspace, and Sonar says it is analyzing both reports:

INFO: Analysing [/home/jenkins/workspace/data-import_coverage-report-test/project/artifacts/coverage/lcov.info, /home/jenkins/workspace/data-import_coverage-report-test/project/coverage/lcov.info]

There's not much in the the sonar report of course since it doesn't differ much from master: https://sonarcloud.io/dashboard?branch=coverage-report-test&id=org.folio%3Aui-data-import

Comment by Mariia Aloshyna [ 03/Aug/20 ]

Hi Ian Hardy, When I was working on this PR I was checking it by <MARCTable> component coverage. As you can see here the coverage of this component is quite low because the Jest report was overwritten or smth like that, and coverage indicators should be equal to data from a screenshot in PR's description (> 80%). I'm not sure if this information helps for your case, but this is how I checked it.
Let me know if any help is needed.

Comment by Ian Hardy [ 04/Aug/20 ]

OK, I think Sonar is already merging these for us, so we don't have to worry about that. The reports that are published in Jenkins are not merged. One option would be to make sure we publish them with separate names so they don't clobber one another, something like this:

https://jenkins-aws.indexdata.com/job/folio-org/job/ui-data-import/job/coverage-report-test/4/ (notice the report names BigTest and jest).

I'd also like to try merging the reports first, that's in the spirit of the original request and might be cleaner to manage in Jenkins. I noticed there's js library for this. I'll give it a try and report back: https://github.com/mweibel/lcov-result-merger

Comment by David Crossley [ 09/Aug/20 ]

Giving reports those specific names (BigTest and Jest) will clash with other testing frameworks (e.g. Cypress).

Comment by Ian Hardy [ 10/Aug/20 ]

Thanks for the heads up David Crossley. I think we can close this investigation then since sonar supports merging multiple reports. In order to do so, a developer needs to set up so one report is created at coverage/lcov.info, and the other is created at artifacts/coverage/lcov.info.

Jenkins will not publish both of these reports on the build result. If we want Jenkins to publish a merged report it needs to be done by some other means. For JS modules, might be worth looking at using https://github.com/mweibel/lcov-result-merger.

David Crossley are you happy with this method of merging reports in Sonar (i.e. making use of the existing sonar scan paths)?

Comment by David Crossley [ 10/Aug/20 ]

Yes, that is fine.

Comment by David Crossley [ 19/Aug/20 ]

Added FAQ https://dev.folio.org/faqs/how-to-integrate-coverage-reports/

Generated at Thu Feb 08 23:22:37 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.