Skip to content

Commit

Permalink
feat: added sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminPabst committed Jan 7, 2025
1 parent 9c12ac8 commit 11bc029
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 2 deletions.
6 changes: 5 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export default {
displayName: 'onecx-chat-ui',
preset: './jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: './coverage/onecx-chat-ui',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
Expand All @@ -25,4 +24,9 @@ export default {
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
],
testEnvironment: '@happy-dom/jest-environment',
collectCoverage: true,
coverageDirectory: './reports/coverage/',
coveragePathIgnorePatterns: ['src/app/shared/generated'],
coverageReporters: ['clover', 'json', 'lcov', 'text', 'text-summary', 'html'],
testResultsProcessor: 'jest-sonar-reporter',
};
207 changes: 207 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "nx lint",
"lint:fix": "nx lint --fix",
"test": "nx test",
"test:ci": "nx test --watch=false --browsers=ChromeHeadless --code-coverage"
"test:ci": "nx test --watch=false --browsers=ChromeHeadless --coverage"
},
"private": true,
"dependencies": {
Expand Down Expand Up @@ -56,6 +56,7 @@
"primeicons": "^7.0.0",
"primeng": "^17.18.8",
"rxjs": "~7.8.0",
"sonarqube-scanner": "^4.2.6",
"zod": "^3.22.1",
"zone.js": "~0.14.3"
},
Expand Down
29 changes: 29 additions & 0 deletions sonar-local-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# sonar.verbose=true
# run locally:
# docker run -p 9000:9000 sonarqube:lts
# user/pwd: admin/admin
# generate project token!
# start:
# npm run sonar
#
sonar.host.url=http://localhost:9000
sonar.login=<generated-project-token>
sonar.verbose=true
#
sonar.organization=onecx
sonar.projectKey=onecx-chat-ui
sonar.projectName=onecx-chat-ui
#
sonar.scm.disabled=true
sonar.sources=src
sonar.sourceEncoding=UTF-8
#
sonar.javascript.coveragePlugin=lcov
sonar.javascript.lcov.reportPaths=./reports/coverage/lcov.info
sonar.testExecutionReportPaths=./reports/sonarqube_report.xml
sonar.working.directory=./reports/.scannerwork
sonar.coverage.exclusions=*.ts,*.js,*.json,*.properties,src/*.ts,helm/**/*,src/*.ico,src/**/*.module.ts,src/**/*.main.ts,src/**/*.bootstrap.ts,src/environments/*,src/assets/**/*,src/app/*,src/app/shared/generated/**/*
sonar.exclusions=src/app/shared/generated/**/*
#sonar.cpd.exclusions=
#sonar.tests=src/app
sonar.test.inclusions=src/app/**/*.spec.ts

0 comments on commit 11bc029

Please sign in to comment.