今天在写单元测试报的错
ERROR [coverage]: TypeError: Cannot read property 'text' of undefined
at D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:288:54
at Array.forEach (<anonymous>)
at annotateBranches (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:255:30)
at HtmlReport.writeDetailPage (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:426:9)
at D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:489:26
at SyncFileWriter.writeFile (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\util\file-writer.js:57:9)
at FileWriter.writeFile (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\util\file-writer.js:147:23)
at D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:488:24
at Array.forEach (<anonymous>)
at HtmlReport.writeFiles (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:482:23)
at D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:484:22
at Array.forEach (<anonymous>)
at HtmlReport.writeFiles (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:482:23)
at HtmlReport.writeReport (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\node_modules\istanbul\lib\report\html.js:566:14)
at writeReport (D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\lib\reporter.js:68:16)
at D:\dev\projects\bennyn\test-coverage\node_modules\karma-coverage\lib\reporter.js:297:11
Done in 2.93s.
https://github.com/gotwarlost/istanbul/issues/817
按照这个https://github.com/gotwarlost/istanbul/pull/819/files/aeed31615dc6051cd26c92ba4891694e6b84e275 加上代码就行了