From 0fe9c458018eae514b996833390f832b21220fe2 Mon Sep 17 00:00:00 2001 From: kurilova Date: Mon, 18 Nov 2024 09:27:09 +0000 Subject: [PATCH 1/3] Adds coverage check --- .github/workflows/testing.yml | 2 +- modules/ui/angular.json | 3 ++- modules/ui/karma.conf.js | 46 +++++++++++++++++++++++++++++++++++ modules/ui/package.json | 1 + 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 modules/ui/karma.conf.js diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2aaa55b25..b14f52c9f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -138,7 +138,7 @@ jobs: - name: Run tests run: | export CHROME_BIN=/usr/bin/chromium-browser - CI=true npm run test-headless + CI=true npm run test-ci env: CI: true working-directory: ./modules/ui diff --git a/modules/ui/angular.json b/modules/ui/angular.json index 8109c8691..28e0e9a36 100644 --- a/modules/ui/angular.json +++ b/modules/ui/angular.json @@ -81,7 +81,8 @@ "inlineStyleLanguage": "scss", "assets": ["src/favicon.ico", "src/assets"], "styles": ["src/styles.scss"], - "scripts": [] + "scripts": [], + "karmaConfig": "karma.conf.js" } }, "lint": { diff --git a/modules/ui/karma.conf.js b/modules/ui/karma.conf.js new file mode 100644 index 000000000..31f3f985a --- /dev/null +++ b/modules/ui/karma.conf.js @@ -0,0 +1,46 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +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') + ], + client: { + 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` + }, + }, + jasmineHtmlReporter: { + suppressAll: true // removes the duplicated traces + }, + coverageReporter: { + dir: require('path').join(__dirname, './coverage/test-run-ui'), + subdir: '.', + reporters: [ + { type: 'html' }, + { type: 'text-summary' } + ], + check: { + global: { + statements: 99, + branches: 99, + functions: 99, + lines: 99 + } + } + }, + reporters: ['progress', 'kjhtml'], + browsers: ['Chrome'], + restartOnFileChange: true + }); +}; diff --git a/modules/ui/package.json b/modules/ui/package.json index b8f777d64..ae6d57f2d 100644 --- a/modules/ui/package.json +++ b/modules/ui/package.json @@ -9,6 +9,7 @@ "test": "ng test", "test:coverage": "ng test --code-coverage", "test-headless": "ng test --browsers=ChromeHeadless --watch=false", + "test-ci": "ng test --no-watch --no-progress --code-coverage --browsers=ChromeHeadless", "docker": "docker rm -f test-run-ui && docker rmi test-run-ui && docker build -t test-run-ui . && docker run -d -p 80:80 --name test-run-ui test-run-ui", "lint": "ng lint", "lint:fix": "ng lint --fix", From df8b4c476cd1a8c7a74a71b4566950ee6096b63e Mon Sep 17 00:00:00 2001 From: kurilova Date: Mon, 18 Nov 2024 09:27:09 +0000 Subject: [PATCH 2/3] Adds coverage check --- modules/ui/karma.conf.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/ui/karma.conf.js b/modules/ui/karma.conf.js index 31f3f985a..addc67157 100644 --- a/modules/ui/karma.conf.js +++ b/modules/ui/karma.conf.js @@ -10,7 +10,7 @@ module.exports = function (config) { require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage'), - require('@angular-devkit/build-angular/plugins/karma') + require('@angular-devkit/build-angular/plugins/karma'), ], client: { jasmine: { @@ -21,26 +21,23 @@ module.exports = function (config) { }, }, jasmineHtmlReporter: { - suppressAll: true // removes the duplicated traces + suppressAll: true, // removes the duplicated traces }, coverageReporter: { dir: require('path').join(__dirname, './coverage/test-run-ui'), subdir: '.', - reporters: [ - { type: 'html' }, - { type: 'text-summary' } - ], + reporters: [{ type: 'html' }, { type: 'text-summary' }], check: { global: { statements: 99, branches: 99, functions: 99, - lines: 99 - } - } + lines: 99, + }, + }, }, reporters: ['progress', 'kjhtml'], browsers: ['Chrome'], - restartOnFileChange: true + restartOnFileChange: true, }); }; From 29f1a2954ae0cc11402f7e4a50636c1526ac0688 Mon Sep 17 00:00:00 2001 From: kurilova Date: Mon, 18 Nov 2024 09:27:09 +0000 Subject: [PATCH 3/3] Adds coverage check --- modules/ui/karma.conf.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ui/karma.conf.js b/modules/ui/karma.conf.js index addc67157..b6d22bd62 100644 --- a/modules/ui/karma.conf.js +++ b/modules/ui/karma.conf.js @@ -29,10 +29,10 @@ module.exports = function (config) { reporters: [{ type: 'html' }, { type: 'text-summary' }], check: { global: { - statements: 99, - branches: 99, - functions: 99, - lines: 99, + statements: 75, + branches: 75, + functions: 75, + lines: 75, }, }, },