我正在运行以下命令进行单元测试并生成代码覆盖率报告.
ng test --code-coverage
我需要查看整个项目的覆盖范围,而不仅仅是有测试的文件.
karma.conf.js
module.exports = function (config) { config.set({ basePath: '',frameworks: ['jasmine','angular-cli'],plugins: [ require('karma-jasmine'),require('karma-jasmine-html-reporter'),require('karma-chrome-launcher'),require('karma-remap-istanbul'),require('angular-cli/plugins/karma'),require('karma-coverage'),require('karma-sourcemap-loader') ],files: [ { pattern: './src/test.ts',watched: false } ],preprocessors: { './src/test.ts': ['angular-cli'] },mime: { 'text/x-typescript': ['ts','tsx'] },remapIstanbulReporter: { reports: { html: 'coverage',lcovonly: './coverage/coverage.lcov' } },angularCli: { config: './angular-cli.json',environment: 'dev' },reporters: config.angularCli && config.angularCli.codeCoverage ? ['progress','karma-remap-istanbul'] : ['progress','kjhtml'],coverageReporter: { includeAllSources: true },port: 9876,colors: true,logLevel: config.LOG_INFO,autoWatch: true,browsers: ['Chrome'],singleRun: false }); };