我们使用伊斯坦布尔代码覆盖率报告程序进行茉莉花单元测试。报告器在html报告中显示分析的摘要和按文件细分:
但是,如果我在html报告中单击源文件,则源文件将按预期方式打开-但此处未显示覆盖率信息:
我希望标记源文件/语句/分支以显示实际结果。
下面的“ karma.config.js”内容:
const webpackConfig = require("./webpack.config.test");
const path = require('path');
const puppeteer = require('puppeteer');
delete webpackConfig.entry;
process.env.CHROME_BIN = puppeteer.executablePath()
module.exports = (config) => {
config.set({
frameworks: ['jasmine'],
client: {
clearContext: true
},
files: ['test/**/*.ts'],
preprocessors: {
'test/**/*.ts': ['webpack']
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
},
coverageIstanbulReporter: {
reports: [ 'html', 'text-summary', 'lcovonly', 'cobertura' ],
dir: path.join(__dirname, 'coverage'),
fixWebpackSourcePaths: true,
'report-config': {
html: { outdir: 'html' }
}
},
reporters: ['spec', 'junit', 'coverage-istanbul'],
junitReporter: {
outputDir: './junit'
},
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ["ChromeHeadlessNoSandbox"],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
singleRun: true
})
}
任何暗示我也需要在源文件中显示覆盖率信息的提示也将受到高度赞赏。