3
我通過伊斯坦布爾檢查TypeScript文件中的測試覆蓋率。我需要通過karma-coverage設置測試閾值。伊斯坦布爾的報告與業務覆蓋報告(我使用Angular-cli)不匹配,因爲業務覆蓋檢查測試JavaScript文件而非TypeScript的報道。我使用了其他插件,例如karma-threshold-reporter,istanbul-threshold-checker,但結果相同。我該如何解決它?Karma覆蓋率檢查JS文件中的測試覆蓋率而不是Angular 2中的TS
report generate for typeScript files
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-remap-istanbul'),
require('karma-coverage'),
require('angular-cli/plugins/karma')
],
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['angular-cli']
},
remapIstanbulReporter: {
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
},
coverageReporter: {
dir: 'coverage/',
reporters: [
{type: 'text-summary'},
{type: 'html'}
],
check: {
global: {
statements: 70,
branches: 70,
functions: 70,
lines: 50
}
}
},
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: ['progress', 'karma-remap-istanbul', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};