This repository was archived by the owner on Dec 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 784
Merging reports fails if base report doesn't contain all files #207
Comments
This doesn't seem right to me - at least the root cause is not what you think it is although it appears that way. Is there a way you can provide a reproducible test case for this? |
My setup is complex, doesn't lend itself easily to a test case. Would it help if I provided output from istanbul with --verbose? I could send that to you directly. |
Sure, I can take a look. It may not be enough though. |
I'm not certain if I ran into the same issue or if this is a issue with nyc but I just got this error: Ping @bcoe I ran this command
I can't reproduce it though. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I use istanbul on a node.js application where some services are started as subprocesses. To enable code coverage of those, I followed advice for issue #97.
So I start the subprocesses as "istanbul cover /index.js --dir -- " and code coverage goes into uniquely named subdirectories of ./coverage.
Then I run "istanbul report" to generate a merged coverage report. However, parsing fails if coverage on a subprocess exists for source file names which are not mentioned in the base report. This happens because my tests do not "require" js files used by subprocesses, and the base report has no coverage for those files (the filenames are not included at all), as described in issue #142.
I can work around the problem by creating a no-op test that explicitly does "require" on all the source files from my services (as advised by someone in #142), the filenames then show up in the base report with near-zero code coverage, and parsing at "istanbul report" step works fine, giving me a merged report that includes subprocess coverage. But without the "require" hack, I get this error (doesn't matter which report format is used):
$ istanbul report
Using reporter [lcov]
/usr/local/lib/node_modules/istanbul/lib/object-utils.js:58
var line = statementMap[st].start.line,
^
TypeError: Cannot read property 'start' of undefined
at /usr/local/lib/node_modules/istanbul/lib/object-utils.js:58:44
at Array.forEach (native)
at Object.addDerivedInfoForFile (/usr/local/lib/node_modules/istanbul/lib/object-utils.js:57:37)
at Object.Collector.fileCoverageFor (/usr/local/lib/node_modules/istanbul/lib/collector.js:93:15)
at /usr/local/lib/node_modules/istanbul/lib/report/html.js:517:90
at Array.forEach (native)
at HtmlReport.Report.mix.writeReport (/usr/local/lib/node_modules/istanbul/lib/report/html.js:516:27)
at LcovReport.Report.mix.writeReport (/usr/local/lib/node_modules/istanbul/lib/report/lcov.js:45:19)
at /usr/local/lib/node_modules/istanbul/lib/command/report.js:100:22
at /usr/local/lib/node_modules/istanbul/lib/util/file-matcher.js:35:9
The text was updated successfully, but these errors were encountered: