TypeError: cannot read property 'split' of undefined
See original GitHub issueHi,
version: 1.1.1
I am using Karma-coverage to generate lcov report with in-memory report like this:
coverageReporter: {
dir: 'reports/',
reporters: [
{ type: 'in-memory' },
{ type: 'lcov', subdir: 'report-lcov' },
]
},
I am getting the error:
TypeError: Cannot read property 'split' of undefined
at HtmlReport.writeDetailPage ({path}\node_modules\istanbul\lib\report\html.js:412:28)
I tried modifying the html.js to see the result. coverage is sending undefined value to istanbul in the end. My reports are generating properly, but this error fails my build. Is there a fix to it?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:11
Top Results From Across the Web
How to prevent cannot read property split of undefined
This error is a TypeError , and it occurs when calling a method, operand, or argument on the wrong data type, or when...
Read more >How to Prevent cannot read property split of ... - Gopi Gorantala
The "cannot read property 'split' of undefined" error occurs when trying to call split() method on a variable that stores an undefined value....
Read more >Cannot Read Property 'split' of Undefined - freeCodeCamp
it will throw the TypeError: Cannot read property 'split' of undefined error. The split method. When split is called on a string, it...
Read more >Uncaught TypeError: Cannot read property 'split' of undefined
Your question answers itself ;) If og_date contains the date, it's probably a string, so og_date.value is undefined.
Read more >TypeError: Cannot read property 'split' of undefined - SitePoint
TypeError : Cannot read property 'split' of undefined ... Somebody please guide me. Zulfi. Zulf. ... If you want contractCode2 to be a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Ive been doing some debugging and I suspect the root cause is
config.filesis being passed to istanbul despiteconfig.preProcessorspatterns being set to instrument only some files.This is the config for the project Im working on:
Despite the
preProcessorbeing set to only instrumenthelpers.jsbothhelpers.jsandhelpers.test.jsare being reported on.The failure results from coverage report for
helpers.test.jsnot containing the.codeproperty, causing istanbul to check its file store for the contents ofhelpers.test.jsviakarma’sMemoryStorehere. ApparentlyMemoryStoredoes not contain the source code thus causing the value ofcodeto be undefined here.I am not well versed in the internals of
karmaorkarma-coveragebut I will keep looking later today.Thank you @michaelBenin