diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 3f12b4441..b0926bcf9 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -49,5 +49,5 @@ jobs: run: npm install working-directory: ./flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client - name: Run test - run: npm test + run: npm run test:headless working-directory: ./flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client diff --git a/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/package.json b/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/package.json index fb8211624..6ec0a876d 100644 --- a/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/package.json +++ b/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/package.json @@ -8,6 +8,7 @@ "start:production": "node scripts/config-app-server.js", "build": "ng build", "test": "ng test", + "test:headless": "ng test --karma-config=src/karma.headless.conf.js", "lint": "ng lint", "e2e": "ng e2e", "cypress:open": "cypress open", diff --git a/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/karma.conf.js b/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/karma.conf.js index c8b051c48..9e54c4001 100644 --- a/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/karma.conf.js +++ b/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/karma.conf.js @@ -9,9 +9,6 @@ * either express or implied. Refer to the License for the specific permissions and * limitations governing your use of the file. */ - -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html const path = require('path'); module.exports = function (config) { diff --git a/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/karma.headless.conf.js b/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/karma.headless.conf.js new file mode 100644 index 000000000..d4b9ca31b --- /dev/null +++ b/flink-cyber/metron-parser-chain/parser-chains-config-service/frontend/parser-chains-client/src/karma.headless.conf.js @@ -0,0 +1,42 @@ +/* + * Copyright 2020 - 2022 Cloudera. All Rights Reserved. + * + * This file is licensed under the Apache License Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. Refer to the License for the specific permissions and + * limitations governing your use of the file. + */ +const path = require("path"); +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-spec-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + jasmine: { + random: false + } + }, + coverageIstanbulReporter: { + dir: path.join(__dirname, '../coverage/enrichment'), + reports: ['html', 'lcovonly', 'text-summary'], + fixWebpackSourcePaths: true + }, + reporters: ['spec'], + port: 9876, + colors: true, + logLevel: config.INFO, + autoWatch: false, + browsers: ['ChromeHeadless'], + singleRun: true, + restartOnFileChange: false + }); +};