Somehow I have an empty index.html in coverage report folder after running “ng test –code-coverage”:
I tried once and saw the report html file is filled with each component coverage but cannot make it out any more.
and here is the karma.conf.js:
<code>const path = require('path');
module.exports = function(config) {
config.set({
webpack: { node: { fs: 'empty' } },
basePath: './',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-safari-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
jasmine: {
random: false,
verboseDeprecations: true
}
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/SecurusOnline'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' },
],
check: { // Optional: Enforce code coverage thresholds
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
},
},
'report-config': {
html: {subdir: 'html'}
},
verbose: true // output config used by istanbul for debugging
},
files: ['src/test.ts'],
include: ['src/**/*.spec.ts', 'src/**/*.d.ts', 'src/polyfills.ts'],
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
flags: ['--headless', '--disable-gpu', '--disable-web-security', '--no-sandbox', '--disable-setuid-sandbox'],
browserDisconnectTimeout: 30000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 30000,
captureTimeout: 40000
})
}
</code>
<code>const path = require('path');
module.exports = function(config) {
config.set({
webpack: { node: { fs: 'empty' } },
basePath: './',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-safari-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
jasmine: {
random: false,
verboseDeprecations: true
}
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/SecurusOnline'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' },
],
check: { // Optional: Enforce code coverage thresholds
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
},
},
'report-config': {
html: {subdir: 'html'}
},
verbose: true // output config used by istanbul for debugging
},
files: ['src/test.ts'],
include: ['src/**/*.spec.ts', 'src/**/*.d.ts', 'src/polyfills.ts'],
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
flags: ['--headless', '--disable-gpu', '--disable-web-security', '--no-sandbox', '--disable-setuid-sandbox'],
browserDisconnectTimeout: 30000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 30000,
captureTimeout: 40000
})
}
</code>
const path = require('path');
module.exports = function(config) {
config.set({
webpack: { node: { fs: 'empty' } },
basePath: './',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-safari-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
jasmine: {
random: false,
verboseDeprecations: true
}
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/SecurusOnline'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' },
],
check: { // Optional: Enforce code coverage thresholds
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
},
},
'report-config': {
html: {subdir: 'html'}
},
verbose: true // output config used by istanbul for debugging
},
files: ['src/test.ts'],
include: ['src/**/*.spec.ts', 'src/**/*.d.ts', 'src/polyfills.ts'],
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
flags: ['--headless', '--disable-gpu', '--disable-web-security', '--no-sandbox', '--disable-setuid-sandbox'],
browserDisconnectTimeout: 30000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 30000,
captureTimeout: 40000
})
}
Any idea what could be the possible reason? Thanks!