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..b6d22bd62 --- /dev/null +++ b/modules/ui/karma.conf.js @@ -0,0 +1,43 @@ +// 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: 75, + branches: 75, + functions: 75, + lines: 75, + }, + }, + }, + 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",