[ACS-4865] setup and enable code coverage for all projects (#3074)

This commit is contained in:
Denys Vuika
2023-03-20 09:06:19 -04:00
committed by GitHub
parent 86c0bbb998
commit 9609393d1e
37 changed files with 1300 additions and 408 deletions

View File

@@ -1,25 +1,22 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
// process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function(config) {
config.set({
const { join } = require('path');
const { constants } = require('karma');
module.exports = () => {
return {
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-coverage'),
require('karma-mocha-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
files: [
{
pattern:
'./node_modules/@angular/material/prebuilt-themes/indigo-pink.css',
watched: false
},
{
pattern:
'./node_modules/@alfresco/adf-core/bundles/assets/adf-core/i18n/en.json',
@@ -46,18 +43,36 @@ module.exports = function(config) {
'/base/node_modules/@alfresco/adf-content-services/bundles/assets/adf-content-services/i18n/en.json'
},
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},
coverageReporter: {
dir: join(__dirname, './coverage'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }],
check: {
global: {
statements: 75,
branches: 67,
functions: 73,
lines: 75
}
}
},
reporters: ['mocha', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
logLevel: constants.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
customLaunchers: {
@@ -65,19 +80,15 @@ module.exports = function(config) {
base: 'Chrome',
flags: [
'--no-sandbox',
// '--headless',
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222'
]
}
},
singleRun: true,
captureTimeout: 180000,
browserDisconnectTimeout: 180000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 300000,
restartOnFileChange: true,
// workaround for alfresco-js-api builds
webpack: { node: { fs: 'empty' } }
});
};
};