Cannot read property 'text' of undefined
TypeError: Cannot read property 'text' of undefined
at H:\projects\general\modulemanager\node_modules\istanbul-reports\lib\html\annotator.js:149:59
at Array.forEach (native)
at annotateBranches (H:\projects\general\modulemanager\node_modules\istanbul-reports\lib\html\annotator.js:112:30)
at Object.annotateSourceCode (H:\projects\general\modulemanager\node_modules\istanbul-reports\lib\html\annotator.js:191:9)
at HtmlReport.onDetail (H:\projects\general\modulemanager\node_modules\istanbul-reports\lib\html\index.js:217:39)
at LcovReport.(anonymous function) [as onDetail] (H:\projects\general\modulemanager\node_modules\istanbul-reports\lib\lcov\index.js:24:24)
at Visitor.(anonymous function) [as onDetail] (H:\projects\general\modulemanager\node_modules\istanbul-lib-report\lib\tree.js:34:30)
at ReportNode.Node.visit (H:\projects\general\modulemanager\node_modules\istanbul-lib-report\lib\tree.js:123:17)
at H:\projects\general\modulemanager\node_modules\istanbul-lib-report\lib\tree.js:116:23
at Array.forEach (native)
at visitChildren (H:\projects\general\modulemanager\node_modules\istanbul-lib-report\lib\tree.js:115:32)
at ReportNode.Node.visit (H:\projects\general\modulemanager\node_modules\istanbul-lib-report\lib\tree.js:126:5)
at Tree.visit (H:\projects\general\modulemanager\node_modules\istanbul-lib-report\lib\tree.js:158:20)
at H:\projects\general\modulemanager\node_modules\istanbul-api\lib\reporter.js:84:18
at Array.forEach (native)
at Object.Reporter.write (H:\projects\general\modulemanager\node_modules\istanbul-api\lib\reporter.js:82:35)
at exitFn (H:\projects\general\modulemanager\node_modules\istanbul-api\lib\run-cover.js:169:18)
at process.g (events.js:286:16)
at emitOne (events.js:101:20)
at process.emit (events.js:188:7)
at process.exit (internal/process.js:146:15)
at done (H:\projects\general\modulemanager\node_modules\mocha\bin\_mocha:417:32)
at afterWrite (_stream_writable.js:361:3)
at _combinedTickCallback (internal/process/next_tick.js:80:20)
at process._tickCallback (internal/process/next_tick.js:98:9)
"scripts": {
"coverage": "node_modules/.bin/istanbul cover node_modules/mocha/bin/_mocha test -- --compilers js:babel-register --require babel-polyfill"
},
"dependencies": {
"callsite": "^1.0.0"
},
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-plugin-transform-class-properties": "^6.9.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-export-extensions": "^6.8.0",
"babel-plugin-transform-function-bind": "^6.8.0",
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-2": "^6.5.0",
"babel-register": "^6.9.0",
"chai": "^3.5.0",
"istanbul": "^1.1.0-alpha.1",
"mocha": "^2.5.3",
"nodemon": "^1.9.2",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0"
}
I can only test this with istanbul@next, since the stable version delivers an empty coverage report.
That message usually means that the source text for a file does not match what was instrumented.
Is there a way you can provide a basic failing case in a gist or something?
Well, I found the mistake.
It is a problem with babel not generating sourcemaps when not told via command (.babelrc doesn't work in this case).
have the same issue +1
@MatthiasF999 How did you solve?
You need to remove
"sourceMaps": true
from the .babelrc file.
That solved it for me.
I have the same issue and don't have "sourceMaps": true in my .babelrc file.
In my case this problem was casused by running istanbul after browserify-ngannotate in browserify transforms.
I created a patch for this issue: https://github.com/istanbuljs/istanbul-reports/pull/10
For those working with webpack, you can find this useful:
https://github.com/deepsweet/istanbul-instrumenter-loader/issues/32
Basically work with older version of "istanbul-instrumenter-loader": "0.2.0"
I ran into this problem in my Webpack setup. Making istanbul-instrumenter-loader the inner most (last) loader in the chain for my files helped make it work. Also I added sourceMaps: true as a babel option. This is using istanbul-instrumenter-loader 2.0.0.
Most helpful comment
I have the same issue and don't have
"sourceMaps": truein my .babelrc file.