Skip to content

Commit

Permalink
fix: configure sonar unit test reporting, update libs (#9)
Browse files Browse the repository at this point in the history
* fix: removing jest, configure testing, update libs

* fix: prepare local sonar execution

* fix: configure SonarQubeUnitReporter

* fix: restore script test:ci
  • Loading branch information
HenryT-CG authored Jan 1, 2024
1 parent d2c6d99 commit 9140fe3
Show file tree
Hide file tree
Showing 15 changed files with 9,449 additions and 11,900 deletions.
13 changes: 6 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/node_modules

# IDEs and editors
.vscode/
/.idea
.project
.classpath
Expand All @@ -25,12 +24,12 @@
!.vscode/extensions.json

# misc
/.sass-cache
/.gitlab*
/connect.lock
/coverage
/libpeerconnection.log
/typings
.sass-cache
.gitlab*
.scannerwork
connect.lock
reports
typings
*.log

# e2e
Expand Down
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
".angular/**",
".husky/**",
".github/**",
"coverage/**",
".scannerwork/**",
"reports/**",
"dist/**",
"helm/**",
"node_modules/**",
Expand Down
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.idea
.project
.classpath
.c9/
Expand All @@ -32,13 +32,13 @@ speed-measure-plugin*.json
.history/*

# misc
/.angular/cache
/.sass-cache
/.gitlab*
/connect.lock
/coverage
/libpeerconnection.log
/typings
.angular/cache
.sass-cache
.gitlab*
.scannerwork
connect.lock
reports
typings
*.log
*.sh

Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
.husky/**
.docusaurus/
.github/**
.scannerwork/
.prettierignore
.browserslistrc
coverage/**
dist/**
helm/**
nginx/**
reports/**
node_modules
CHANGELOG.md
README.md
Expand Down
23 changes: 0 additions & 23 deletions jest.config.ts

This file was deleted.

15 changes: 0 additions & 15 deletions jest.preset.js

This file was deleted.

44 changes: 36 additions & 8 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
module.exports = function (config) {
config.set({
basePath: '',
logLevel: config.LOG_INFO,
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('karma-jasmine'),
require('karma-jasmine-html-reporter'),
require('karma-junit-reporter'),
require('karma-sonarqube-unit-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
Expand All @@ -24,19 +27,44 @@ module.exports = function (config) {
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
junitReporter: {
outputDir: 'reports/unit-test-results', // results will be saved as $outputDir/$browserName.xml
outputFile: 'results-junit-tests.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: 'models', // suite will become the package name attribute in xml testsuite element
useBrowserName: false, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {} // key value pair of properties to add to the <properties> section of the report
},
sonarqubeReporter: {
basePath: 'src/app', // test files folder
filePattern: '**/*.spec.ts', // test files glob pattern
encoding: 'utf-8', // test files encoding
outputFolder: 'sonar', // report destination
legacyMode: false, // report for Sonarqube < 6.2 (disabled)
reportName: 'sonarqube_report.xml'
},
sonarQubeUnitReporter: {
sonarQubeVersion: 'LATEST',
outputFile: 'reports/sonarqube_report.xml',
testPaths: ['./src/app'],
testFilePattern: '**/*.spec.ts',
useBrowserName: false
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/app'),
subdir: '.',
reporters: [{ type: 'html' }, { type: 'text-summary' }]
includeAllSources: true,
dir: 'reports',
subdir: 'coverage',
reporters: [{ type: 'html' }, { type: 'text-summary' }, { type: 'lcov' }]
},
reporters: ['progress', 'kjhtml'],
reporters: ['progress', 'kjhtml', 'coverage', 'sonarqubeUnit', 'junit'],
preprocessors: { 'src/**/*.js': ['coverage'] },
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['HeadlessChrome'],
singleRun: false,
restartOnFileChange: true,
browsers: ['HeadlessChrome'],
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
Expand Down
7 changes: 7 additions & 0 deletions openapitools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.2.0"
}
}
Loading

0 comments on commit 9140fe3

Please sign in to comment.