What are you trying to achieve: Calculate code coverage for typescript monorepo
What have you tried so far to achieve this, scour the internet looking for possible solutions; enabled verbose logging of sonar-scanner which produced the following errors for coverage:
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7464 of coverage report file (java.lang.IllegalArgumentException: Line with number 13 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7492 of coverage report file (java.lang.IllegalArgumentException: Line with number 12 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7493 of coverage report file (java.lang.IllegalArgumentException: Line with number 13 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7494 of coverage report file (java.lang.IllegalArgumentException: Line with number 15 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7495 of coverage report file (java.lang.IllegalArgumentException: Line with number 20 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7496 of coverage report file (java.lang.IllegalArgumentException: Line with number 31 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7497 of coverage report file (java.lang.IllegalArgumentException: Line with number 43 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7498 of coverage report file (java.lang.IllegalArgumentException: Line with number 50 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7499 of coverage report file (java.lang.IllegalArgumentException: Line with number 61 doesn’t belong to file index.ts).
19:58:14.072 DEBUG Problem during processing LCOV report: can’t save DA data for line 7500 of coverage report file (java.lang.IllegalArgumentException: Line with number 72 doesn’t belong to file index.ts).
I’ve gone through the lcov.info files and spot checked a few of these and the line numbers match up with the source code.
If the full path in the report is accurate why would it get confused?
I also switched from lcov to generic coverage report and have the same outcome.
2026-05-20T15:44:41.797913Z 01O 15:44:40.038 INFO Sensor Generic Coverage Report
2026-05-20T15:44:41.798528Z 01O 15:44:40.039 INFO Parsing <path>/generic-coverage.xml
2026-05-20T15:44:41.874150Z 01O 15:44:40.114 INFO Imported coverage data for 279 files
2026-05-20T15:44:41.874153Z 01O 15:44:40.114 INFO Coverage data ignored for 1 unknown files, including:
2026-05-20T15:44:41.874153Z 01O <path>/IframeBreakoutView.vue
2026-05-20T15:44:41.874154Z 01O 15:44:40.114 INFO Parsing <path>/generic-coverage.xml
2026-05-20T15:44:41.926412Z 01O 15:44:40.167 INFO Imported coverage data for 308 files
2026-05-20T15:44:41.926413Z 01O 15:44:40.167 INFO Parsing <path>/generic-coverage.xml
2026-05-20T15:44:41.939749Z 01O 15:44:40.180 INFO Imported coverage data for 144 files
2026-05-20T15:44:41.939750Z 01O 15:44:40.180 INFO Parsing <path>/generic-coverage.xml
2026-05-20T15:44:41.947179Z 01O 15:44:40.187 INFO Imported coverage data for 92 files
2026-05-20T15:44:41.947181Z 01O 15:44:40.187 INFO Parsing <path>/generic-coverage.xml
2026-05-20T15:44:41.950003Z 01O 15:44:40.190 INFO Imported coverage data for 18 files
2026-05-20T15:44:41.950004Z 01O 15:44:40.190 INFO Parsing <path>/generic-coverage.xml
2026-05-20T15:44:41.965786Z 01O 15:44:40.206 INFO Imported coverage data for 196 files
For example, I see it imported coverage data for 196 files but then when going to the sonar report, none of the files from that coverage report show coverage.
I have line errors using lcov which started this thread. I then switch over to use the generic coverage report to see if that would help but I get the same coverage result using both report types.
Can you provide that debug log? And is it the same files that lack coverage regardless of the report format? (I’m assuming here that coverage does show up for some files…?)
I can update it for the absolute filepath and try again. The debug output is what I’m trying to redact. There is sensitive information in the file paths.
I think this is probably a red herring. Do the file names correspond to any of the files you’re missing coverage for?
Looking at the errors in the log, there are a lot (a lot) of errors about index.ts which leads me to wonder how many files you have named index.ts. I still think this is probably about file confusion.
But also, there are a few sets of lines about other file names. So, are there multiple ExitView.vue files in your project?
Yes, there are ExitView.vue and possibly others in this project with the same name. There are also a lot of index.ts files. This is a pnpm project with a lot of packages in it.
Taking ExitView.vue for example, that shows code coverage just fine in Sonarqube.