In coverage reporter (html)
Trace:
TypeError: Cannot read property 'text' of undefined
at /Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:210:45
at Array.forEach (native)
at annotateStatements (/Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:193:33)
at HtmlReport.Report.mix.writeDetailPage (/Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:428:9)
at /Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:489:26
at SyncFileWriter.extend.writeFile (/Users/arusakov/myproject/node_modules/istanbul/lib/util/file-writer.js:57:9)
at FileWriter.extend.writeFile (/Users/arusakov/myproject/node_modules/istanbul/lib/util/file-writer.js:147:23)
at /Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:488:24
at Array.forEach (native)
at HtmlReport.Report.mix.writeFiles (/Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:482:23)
at /Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:484:22
at Array.forEach (native)
at HtmlReport.Report.mix.writeFiles (/Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:482:23)
at HtmlReport.Report.mix.writeReport (/Users/arusakov/myproject/node_modules/istanbul/lib/report/html.js:566:14)
at writeReport (/Users/arusakov/myproject/node_modules/karma-coverage/lib/reporter.js:62:16)
at /Users/arusakov/myproject/node_modules/karma-coverage/lib/reporter.js:290:11
Related npm modules:
"isparta-loader": "2.0.0",
"istanbul": "0.4.3",
"jasmine-core": "2.4.1",
"karma": "0.13.22",
"karma-coverage": "0.5.4",
"karma-jasmine": "0.3.8",
"karma-junit-reporter": "0.4.2",
"karma-phantomjs-launcher": "1.0.0",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "1.7.0",
"phantomjs-prebuilt": "2.1.7",
I had absolutely the same issue before, but I don't actually know how I fixed it. Just removed all node_modules and re-install again.
@viktordavidovich
Reinstalling doesn't fix error in my case :(
I'm also running into this issue.
I'm using [email protected] and [email protected], though.
Also see #660
Due to this error html report is not generated for some files in my case, but only when running subset of unit tests
+1
I am running into the same issue. I am running manual tests on instrumented JS code and have done setup to export coverage objects into json file. However, "istanbul report" does not seem to work and gives the same error as mentioned by @arusakov
Any help appreciated!
+1
I spent the better part of the morning at work getting this to work. Here's what we did:
babel-plugin-istanbul module and configured exactly per recommendations. I.e., addedenv: { test: { plugins: ['istanbul'] }} to our .babelrc file and removed 'coverage' from preprocessors for our ES6 files. Note that I don't love this as it moves testing config from the karma file into babel, but it worked so I wasn't about to screw it up.karma-coverage-istanbul-reporter module and configure per recommendations and our existing setup. I.e., I removed our coverageReporter property replacing with coverageIstanbulReporter and tweaking the props so they match the expected configuration schema.New schema looks like this (extraneous bits removed):
webpackConfig.module.rules.push({
test: /\.es6/,
enforce: 'post',
exclude: /(test|node_modules)\//,
use: { loader: 'istanbul-instrumenter-loader', options: { esModules: true } }
})
const overrideConf = {
reporters: ['coverage-istanbul', 'mocha', 'junit'],
coverageIstanbulReporter: {
dir: '../coverage',
fixWebpackSourcePaths: true,
reports: ['cobertura', 'lcov', 'text', 'text-summary'],
skipFilesWithNoCoverage: true
},
mochaReporter: {
ignoreSkipped: true
},
autoWatch: false,
preprocessors: {
'./testImporter.karma.es6': ['webpack', 'sourcemap']
},
webpack: webpackConfig
}
And the relevant portions of package.json (again, extraneous bits removed):
"babel-plugin-istanbul": "^4.1.5",
"istanbul": "^0.4.5",
"istanbul-instrumenter-loader": "^3.0.0",
"karma-coverage": "^1.1.1",
"karma-coverage-istanbul-reporter": "^1.3.3",
@gotwarlost
Come on guys? Let's get this fixed issue fixed and merged already.
As mentioned by @icfantv I managed to get rid of this issue by using karma-coverage-istanbul-reporter
I added these two to my karma config
coverageIstanbulReporter: {
dir: 'coverageReport/html/client',
reports: ['html', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: [
'progress',
'coverage-istanbul',
]
@saulve- can you please provide complete karma config file, bcz I am not able to generate coverage report in VSTS.
Most helpful comment
+1