karma-coverage: TypeError: Cannot read property 'split' of undefined
karma-coverage: TypeError: Cannot read property 'split' of undefined
我正在尝试通过业力报道来支持 lcov 记者。我像这样修改了我的业力配置:
coverageReporter: {
dir: 'reports/',
reporters: [
{ type: 'in-memory' },
{ type: 'lcov', subdir: 'report-lcov' },
]
},
我一直收到错误消息:
ERROR [coverage]: TypeError: Cannot read property 'split' of undefined
at HtmlReport.writeDetailPage ({path}\node_modules\istanbul\lib\report\html.js:413:33)
我收到了所需的报告,但此错误导致我的构建失败。
有办法解决这个问题吗?
我能够通过使用不同的包解决这个问题。 karma-remap-istanbul.
Karma.conf.js
的变化
remapIstanbulReporter: {
remapOptions: {}, //additional remap options
reports: {
'text-summary': null, // to display summary results on console
json: 'coverage/coverage.json',
lcovonly: 'coverage/lcov.info',
html: 'coverage/html/',
}
},
reporters: [ 'mocha', 'coverage', 'karma-remap-istanbul'],
webpack 测试配置的变化。我添加了 karma-remap-coverage
支持的加载器 sourcemap-istanbul-instrumenter-loader
而不是 istanbul-intrumenter-loader
{
enforce: 'post',
test: /\.(js|ts)$/,
loader: 'sourcemap-istanbul-instrumenter-loader',
include: helpers.root('src'),
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/
]
}
我能够顺利生成 lcov 报告。
希望这对面临同样问题的其他人有所帮助。
我正在尝试通过业力报道来支持 lcov 记者。我像这样修改了我的业力配置:
coverageReporter: {
dir: 'reports/',
reporters: [
{ type: 'in-memory' },
{ type: 'lcov', subdir: 'report-lcov' },
]
},
我一直收到错误消息:
ERROR [coverage]: TypeError: Cannot read property 'split' of undefined
at HtmlReport.writeDetailPage ({path}\node_modules\istanbul\lib\report\html.js:413:33)
我收到了所需的报告,但此错误导致我的构建失败。 有办法解决这个问题吗?
我能够通过使用不同的包解决这个问题。 karma-remap-istanbul.
Karma.conf.js
的变化remapIstanbulReporter: {
remapOptions: {}, //additional remap options
reports: {
'text-summary': null, // to display summary results on console
json: 'coverage/coverage.json',
lcovonly: 'coverage/lcov.info',
html: 'coverage/html/',
}
},
reporters: [ 'mocha', 'coverage', 'karma-remap-istanbul'],
webpack 测试配置的变化。我添加了 karma-remap-coverage
支持的加载器sourcemap-istanbul-instrumenter-loader
而不是 istanbul-intrumenter-loader
{
enforce: 'post',
test: /\.(js|ts)$/,
loader: 'sourcemap-istanbul-instrumenter-loader',
include: helpers.root('src'),
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/
]
}
我能够顺利生成 lcov 报告。
希望这对面临同样问题的其他人有所帮助。