Skip to content

Commit

Permalink
[AAE-12242] Fix code coverage (#8404)
Browse files Browse the repository at this point in the history
* fix code coverage
  • Loading branch information
eromano authored Mar 21, 2023
1 parent c884b06 commit 0c4cc37
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 85 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ jobs:
exclude: "insights,core,extensions,process-services,process-services-cloud"
- name: core
exclude: "insights,content-services,process-services,process-services-cloud"
- name: insights and process-services
exclude: "core,extensions,content-services,process-services-cloud"
- name: insights
exclude: "core,extensions,content-services,process-services-cloud,process-services"
- name: process-services
exclude: "core,extensions,content-services,process-services-cloud,insights"
- name: process-cloud
exclude: "insights,core,extensions,content-services,process-services"
steps:
Expand Down
16 changes: 11 additions & 5 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
"tsConfig": "lib/core/tsconfig.spec.json",
"karmaConfig": "lib/core/karma.conf.js",
"sourceMap": true,
"codeCoverage": true,
"styles": [
"demo-shell/src/assets/fonts/material-icons/material-icons.css"
]
Expand Down Expand Up @@ -484,7 +485,8 @@
"main": "lib/content-services/src/test.ts",
"tsConfig": "lib/content-services/tsconfig.spec.json",
"karmaConfig": "lib/content-services/karma.conf.js",
"sourceMap": true
"sourceMap": true,
"codeCoverage": true
}
},
"lint": {
Expand Down Expand Up @@ -603,7 +605,8 @@
"main": "lib/process-services/src/test.ts",
"tsConfig": "lib/process-services/tsconfig.spec.json",
"karmaConfig": "lib/process-services/karma.conf.js",
"sourceMap": true
"sourceMap": true,
"codeCoverage": true
}
},
"lint": {
Expand Down Expand Up @@ -688,7 +691,8 @@
"main": "lib/process-services-cloud/src/test.ts",
"tsConfig": "lib/process-services-cloud/tsconfig.spec.json",
"karmaConfig": "lib/process-services-cloud/karma.conf.js",
"sourceMap": true
"sourceMap": true,
"codeCoverage": true
}
},
"lint": {
Expand Down Expand Up @@ -818,7 +822,8 @@
"main": "lib/insights/src/test.ts",
"tsConfig": "lib/insights/tsconfig.spec.json",
"karmaConfig": "lib/insights/karma.conf.js",
"sourceMap": true
"sourceMap": true,
"codeCoverage": true
}
},
"lint": {
Expand Down Expand Up @@ -892,7 +897,8 @@
"main": "lib/extensions/src/test.ts",
"tsConfig": "lib/extensions/tsconfig.spec.json",
"karmaConfig": "lib/extensions/karma.conf.js",
"sourceMap": true
"sourceMap": true,
"codeCoverage": true
}
},
"lint": {
Expand Down
27 changes: 19 additions & 8 deletions lib/content-services/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require('path');
const { constants } = require('karma');

module.exports = function (config) {
config.set({
basePath: '../../',
Expand Down Expand Up @@ -55,15 +58,23 @@ module.exports = function (config) {
}
},

coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/content-services'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},

browserDisconnectTimeout: 200000,
browserNoActivityTimeout: 2400000,
captureTimeout: 1200000,
coverageReporter: {
dir: join(__dirname, './coverage/content-services'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }],
check: {
global: {
statements: 75,
branches: 67,
functions: 73,
lines: 75
}
}
},

customLaunchers: {
ChromeHeadless: {
Expand All @@ -80,7 +91,7 @@ module.exports = function (config) {
reporters: ['mocha', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
logLevel: constants.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
singleRun: true
Expand Down
27 changes: 19 additions & 8 deletions lib/core/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require('path');
const { constants } = require('karma');

module.exports = function (config) {
config.set({
basePath: '../../',
Expand Down Expand Up @@ -74,15 +77,23 @@ module.exports = function (config) {
random: false
}
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/core'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},

browserDisconnectTimeout: 200000,
browserNoActivityTimeout: 2400000,
captureTimeout: 1200000,
coverageReporter: {
dir: join(__dirname, './coverage/core'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }],
check: {
global: {
statements: 75,
branches: 67,
functions: 73,
lines: 75
}
}
},

customLaunchers: {
ChromeHeadless: {
Expand All @@ -99,7 +110,7 @@ module.exports = function (config) {
reporters: ['mocha', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
logLevel: constants.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
singleRun: true
Expand Down
91 changes: 53 additions & 38 deletions lib/extensions/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,57 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const {join} = require('path');
const {constants} = require('karma');

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-mocha-reporter')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['mocha', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222'
]
}
},
singleRun: true
});
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-mocha-reporter')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},

coverageReporter: {
dir: join(__dirname, './coverage/extensions'),
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: constants.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222'
]
}
},
singleRun: true
});
};
28 changes: 20 additions & 8 deletions lib/insights/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require('path');
const { constants } = require('karma');

module.exports = function (config) {
config.set({
basePath: '../../',
Expand Down Expand Up @@ -56,15 +59,24 @@ module.exports = function (config) {
random: false
}
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/insights'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true

jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},

browserDisconnectTimeout: 200000,
browserNoActivityTimeout: 2400000,
captureTimeout: 1200000,
coverageReporter: {
dir: join(__dirname, './coverage/insights'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }],
check: {
global: {
statements: 75,
branches: 50,
functions: 73,
lines: 75
}
}
},

customLaunchers: {
ChromeHeadless: {
Expand All @@ -81,7 +93,7 @@ module.exports = function (config) {
reporters: ['mocha', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
logLevel: constants.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
singleRun: true
Expand Down
27 changes: 19 additions & 8 deletions lib/process-services-cloud/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require('path');
const { constants } = require('karma');

module.exports = function (config) {
config.set({
basePath: '../../',
Expand Down Expand Up @@ -54,15 +57,23 @@ module.exports = function (config) {
random: false
}
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/process-services-cloud'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},

browserDisconnectTimeout: 200000,
browserNoActivityTimeout: 2400000,
captureTimeout: 1200000,
coverageReporter: {
dir: join(__dirname, './coverage/process-service-cloud'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }],
check: {
global: {
statements: 75,
branches: 67,
functions: 73,
lines: 75
}
}
},

customLaunchers: {
ChromeHeadless: {
Expand All @@ -79,7 +90,7 @@ module.exports = function (config) {
reporters: ['mocha', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
logLevel: constants.LOG_INFO,
autoWatch: true,
browsers: ['ChromeHeadless'],
singleRun: true
Expand Down
Loading

0 comments on commit 0c4cc37

Please sign in to comment.