From fc691bed6b0aaf4de85b3f47cf52dd8cec402e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Fri, 3 May 2024 11:02:05 +0200 Subject: [PATCH 01/33] refactor(toolchain): remove `jest-html-reporters` OUI-3062 --- package-lock.json | 39 ++++--------------- package.json | 1 - projects/oblique/jest.config.js | 1 - projects/oblique/jest.config.prod.js | 1 - projects/sandbox/jest.config.js | 1 - projects/sds/jest.config.js | 1 - .../jest.config.js | 1 - tests/jest.config.js | 11 +----- 8 files changed, 8 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index e525fe3fe..e43cc4c73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,7 +56,6 @@ "eslint-config-prettier": "^9.1.0", "husky": "^9.0.11", "jest": "^29.7.0", - "jest-html-reporters": "^3.1.7", "jest-sonar-reporter": "^2.0.0", "lint-staged": "^15.2.2", "prettier": "^3.2.5", @@ -10124,20 +10123,6 @@ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, - "node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/fs-minipass": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", @@ -12019,16 +12004,6 @@ "fsevents": "^2.3.2" } }, - "node_modules/jest-html-reporters": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/jest-html-reporters/-/jest-html-reporters-3.1.7.tgz", - "integrity": "sha512-GTmjqK6muQ0S0Mnksf9QkL9X9z2FGIpNSxC52E0PHDzjPQ1XDu2+XTI3B3FS43ZiUzD1f354/5FfwbNIBzT7ew==", - "dev": true, - "dependencies": { - "fs-extra": "^10.0.0", - "open": "^8.0.3" - } - }, "node_modules/jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", @@ -19903,16 +19878,16 @@ "@angular/common": "^17.0.0 || ^18.0.0", "@angular/compiler": "^17.0.0 || ^18.0.0", "@angular/core": "^17.0.0 || ^18.0.0", - "@angular/forms": "^17.3.7", + "@angular/forms": "^17.0.0 || ^18.0.0", "@angular/material": "^17.0.0 || ^18.0.0", "@angular/platform-browser": "^17.0.0 || ^18.0.0", - "@angular/platform-browser-dynamic": "^17.3.7", - "@angular/router": "^17.3.7", - "@ngx-translate/core": "^15.0.0", - "@popperjs/core": "^2.11.8", - "ajv": "^8.13.0", + "@angular/platform-browser-dynamic": "^17.0.0 || ^18.0.0", + "@angular/router": "^17.0.0 || ^18.0.0", + "@ngx-translate/core": ">=15.0.0", + "@popperjs/core": "^2.0.0", + "ajv": "^8.0.0", "ajv-formats": "^2.0.0", - "angular-oauth2-oidc": "^17.0.2", + "angular-oauth2-oidc": "^17.0.0", "jwt-decode": "^4.0.0", "rxjs": "^7.0.0" } diff --git a/package.json b/package.json index 11da22473..4f80d65cb 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,6 @@ "eslint-config-prettier": "^9.1.0", "husky": "^9.0.11", "jest": "^29.7.0", - "jest-html-reporters": "^3.1.7", "jest-sonar-reporter": "^2.0.0", "lint-staged": "^15.2.2", "prettier": "^3.2.5", diff --git a/projects/oblique/jest.config.js b/projects/oblique/jest.config.js index 2f6ff08ab..efb03ffe6 100644 --- a/projects/oblique/jest.config.js +++ b/projects/oblique/jest.config.js @@ -6,4 +6,3 @@ module.exports.displayName = { name: 'Oblique', color: 'cyan' }; -module.exports.reporters[1][1].publicPath = '/jest-report/oblique'; diff --git a/projects/oblique/jest.config.prod.js b/projects/oblique/jest.config.prod.js index 3e31c3020..d1036da19 100644 --- a/projects/oblique/jest.config.prod.js +++ b/projects/oblique/jest.config.prod.js @@ -2,7 +2,6 @@ module.exports = require('./jest.config'); module.exports.testResultsProcessor = 'jest-sonar-reporter'; -module.exports.reporters = undefined; module.exports.collectCoverageFrom = [ '/projects/oblique/src/lib/**/*.ts', '!**/_mocks/**', diff --git a/projects/sandbox/jest.config.js b/projects/sandbox/jest.config.js index 7d346e149..5bcc8c3a1 100644 --- a/projects/sandbox/jest.config.js +++ b/projects/sandbox/jest.config.js @@ -10,7 +10,6 @@ module.exports.displayName = { name: 'Sandbox', color: 'magenta' }; -module.exports.reporters[1][1].publicPath = '/jest-report/sandbox'; module.exports.coveragePathIgnorePatterns = [ '/node_modules/', '/projects/oblique', diff --git a/projects/sds/jest.config.js b/projects/sds/jest.config.js index ae1718de2..d1afaadb6 100644 --- a/projects/sds/jest.config.js +++ b/projects/sds/jest.config.js @@ -15,7 +15,6 @@ module.exports.testPathIgnorePatterns = [ '/projects/sds/schematics/src/add-code-example/templates', '/projects/sds/schematics/src/add-preview/templates' ]; -module.exports.reporters[1][1].publicPath = '/jest-report/sds'; module.exports.displayName = { name: 'SDS', color: 'gray' diff --git a/projects/service-navigation-web-component/jest.config.js b/projects/service-navigation-web-component/jest.config.js index a5b82712f..85ba7a929 100644 --- a/projects/service-navigation-web-component/jest.config.js +++ b/projects/service-navigation-web-component/jest.config.js @@ -10,7 +10,6 @@ module.exports.displayName = { name: 'Service Navigation Web Component', color: 'magenta' }; -module.exports.reporters[1][1].publicPath = '/jest-report/service-navigation-web-component'; module.exports.coveragePathIgnorePatterns = [ '/node_modules/', '/projects/oblique', diff --git a/tests/jest.config.js b/tests/jest.config.js index 39881ff26..5e11bb763 100644 --- a/tests/jest.config.js +++ b/tests/jest.config.js @@ -5,14 +5,5 @@ globalThis.ngJest = { module.exports = { preset: 'jest-preset-angular', setupFilesAfterEnv: ['/tests/setupJest.ts'], - collectCoverage: true, - reporters: [ - 'default', - [ - 'jest-html-reporters', - { - publicPath: '/jest-report' - } - ] - ] + collectCoverage: true }; From 7697028dc67776d21bb7ebfce7cbff14b124ccd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 29 Apr 2024 23:37:19 +0200 Subject: [PATCH 02/33] refactor(oblique/toolchain): create a "default" test configuration The "default" configuration replaces the previous "development" one. It is called through the `test` script and it makes sure the coverage is collected in a dedicated repository. The coverage thresholds are also set. OUI-3062 --- angular.json | 4 +- projects/oblique/jest.config.js | 178 ++++++++++++++++++++++++++++++++ projects/oblique/package.json | 2 +- 3 files changed, 181 insertions(+), 3 deletions(-) diff --git a/angular.json b/angular.json index aed72269e..5656fbc57 100644 --- a/angular.json +++ b/angular.json @@ -61,14 +61,14 @@ "run-in-band": ["true"] }, "configurations": { - "development": { + "default": { "configPath": "jest.config.js" }, "production": { "configPath": "jest.config.prod.js" } }, - "defaultConfiguration": "production" + "defaultConfiguration": "default" } } }, diff --git a/projects/oblique/jest.config.js b/projects/oblique/jest.config.js index efb03ffe6..86b4956f2 100644 --- a/projects/oblique/jest.config.js +++ b/projects/oblique/jest.config.js @@ -6,3 +6,181 @@ module.exports.displayName = { name: 'Oblique', color: 'cyan' }; +module.exports.coverageDirectory = '/coverage/oblique'; +module.exports.collectCoverageFrom = [ + '/projects/oblique/src/lib/**/*.ts', + '!**/_mocks/**', + '!**/*.module.ts', + '!**/**.harness.ts', + '!**/index.ts', + // the following files have no spec files and therefore have a 0 coverage. Tests will be written later + '!**/http-api-interceptor.ts', + '!**/off-canvas-container.directive.ts', + '!**/schema-required.directive.ts' +]; +module.exports.coverageThreshold = { + /* + * "global" combines all files that are not covered by another rules. The thresholds do not apply per file but globally. + * This means the global coverage might be sufficient even if a specific file has too weak a coverage. + */ + global: { + statements: 100, + branches: 100, + functions: 100, + lines: 100 + }, + // The following rules do apply to all target files individually + 'projects/oblique/src/lib/breadcrumb/*.ts': { + statements: 98, + branches: 78, + functions: 95, + lines: 98 + }, + 'projects/oblique/src/lib/button/*.ts': { + statements: 100, + branches: 76, + functions: 100, + lines: 100 + }, + 'projects/oblique/src/lib/checkbox/*.ts': { + statements: 90, + branches: 60, + functions: 70, + lines: 90 + }, + 'projects/oblique/src/lib/collapse/*.ts': { + statements: 100, + branches: 81, + functions: 100, + lines: 100 + }, + 'projects/oblique/src/lib/column-layout/column-layout.component.ts': { + branches: 94 + }, + 'projects/oblique/src/lib/document-meta/*.ts': { + statements: 60, + branches: 7, + functions: 18, + lines: 59 + }, + 'projects/oblique/src/lib/error-messages/*.ts': { + statements: 52, + branches: 0, + functions: 11, + lines: 52 + }, + 'projects/oblique/src/lib/file-upload/progress/*.ts': { + statements: 100, + branches: 88, + functions: 100, + lines: 100 + }, + 'projects/oblique/src/lib/http-api-interceptor/*.ts': { + statements: 25, + branches: 0, + functions: 0, + lines: 21 + }, + 'projects/oblique/src/lib/icon/*.ts': { + statements: 96, + branches: 75, + functions: 100, + lines: 95 + }, + 'projects/oblique/src/lib/input-clear/*.ts': { + statements: 96, + branches: 85, + functions: 100, + lines: 95 + }, + 'projects/oblique/src/lib/master-layout/*.ts': { + statements: 93, + branches: 66, + functions: 80, + lines: 91 + }, + 'projects/oblique/src/lib/master-layout/master-layout/*.ts': { + statements: 87, + branches: 56, + functions: 74, + lines: 86 + }, + 'projects/oblique/src/lib/master-layout/master-layout-header/*.ts': { + statements: 82, + branches: 65, + functions: 75, + lines: 82 + }, + 'projects/oblique/src/lib/master-layout/master-layout-navigation/*.ts': { + statements: 65, + branches: 53, + functions: 53, + lines: 65 + }, + 'projects/oblique/src/lib/master-layout/master-layout-navigation/sub-menu-item/*.ts': { + statements: 80, + branches: 88, + functions: 90, + lines: 80 + }, + 'projects/oblique/src/lib/multi-translate-loader/*.ts': { + statements: 22, + branches: 0, + functions: 0, + lines: 25 + }, + 'projects/oblique/src/lib/nav-tree/*.ts': { + statements: 91, + branches: 72, + functions: 96, + lines: 91 + }, + 'projects/oblique/src/lib/nested-form/*.ts': { + statements: 66, + branches: 90, + functions: 25, + lines: 63 + }, + 'projects/oblique/src/lib/notification/*.ts': { + statements: 90, + branches: 77, + functions: 78, + lines: 96 + }, + 'projects/oblique/src/lib/number-format/*.ts': { + statements: 82, + branches: 77, + functions: 85, + lines: 81 + }, + 'projects/oblique/src/lib/off-canvas/*.ts': { + statements: 70, + branches: 77, + functions: 33, + lines: 66 + }, + 'projects/oblique/src/lib/schema-validation/*.ts': { + statements: 79, + branches: 69, + functions: 75, + lines: 79 + }, + 'projects/oblique/src/lib/scrolling/*.ts': { + statements: 33, + branches: 83, + functions: 0, + lines: 27 + }, + 'projects/oblique/src/lib/selectable/*.ts': { + statements: 100, + branches: 81, + functions: 100, + lines: 100 + }, + 'projects/oblique/src/lib/sticky/*.ts': { + statements: 93, + branches: 85, + functions: 100, + lines: 95 + } +}; diff --git a/projects/oblique/package.json b/projects/oblique/package.json index d48a6d960..ad222dc5e 100644 --- a/projects/oblique/package.json +++ b/projects/oblique/package.json @@ -8,7 +8,7 @@ "lint": "ts-node scripts/lint.ts", "format": "ts-node scripts/lint.ts --fix", "test": "cd ../.. && ng test oblique", - "test-debugging": "cd ../.. && node --expose-gc ../../node_modules/@angular/cli/bin/ng run oblique:test:development --log-heap-usage", + "test-debugging": "cd ../.. && node --expose-gc ../../node_modules/@angular/cli/bin/ng test oblique --log-heap-usage", "prebuild": "ts-node scripts/pre-dist/run-pre-dist-steps.ts && ng build oblique-styles", "build": "ng build oblique && npm run schematics", "postbuild": "ts-node scripts/post-dist/run-post-dist-steps.ts", From 23b1796a1b22dffdf7ad987b461ceaf6527b1822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 29 Apr 2024 23:40:30 +0200 Subject: [PATCH 03/33] refactor(oblique/toolchain): create a "ci" test configuration The "ci" configuration replaces the previous "production" one. and is called through the `test-ci` script. It extends the "default" configuration, but it also generates a test report for Sonar into a dedicated directory. OUI-3062 --- angular.json | 4 +- package.json | 2 +- projects/oblique/jest.config.ci.js | 4 + projects/oblique/jest.config.prod.js | 181 --------------------------- projects/oblique/package.json | 1 + sonar-project.properties | 4 +- 6 files changed, 10 insertions(+), 186 deletions(-) create mode 100644 projects/oblique/jest.config.ci.js delete mode 100644 projects/oblique/jest.config.prod.js diff --git a/angular.json b/angular.json index 5656fbc57..9898bf800 100644 --- a/angular.json +++ b/angular.json @@ -64,8 +64,8 @@ "default": { "configPath": "jest.config.js" }, - "production": { - "configPath": "jest.config.prod.js" + "ci": { + "configPath": "jest.config.ci.js" } }, "defaultConfiguration": "default" diff --git a/package.json b/package.json index 4f80d65cb..31f1b770a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "node": ">=18.13.0" }, "jestSonar": { - "reportPath": "./coverage", + "reportPath": "./coverage/oblique", "reportFile": "sqr.xml", "indent": 4, "sonar56x": true diff --git a/projects/oblique/jest.config.ci.js b/projects/oblique/jest.config.ci.js new file mode 100644 index 000000000..4bffe239d --- /dev/null +++ b/projects/oblique/jest.config.ci.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./jest.config'); +module.exports.testResultsProcessor = 'jest-sonar-reporter'; diff --git a/projects/oblique/jest.config.prod.js b/projects/oblique/jest.config.prod.js deleted file mode 100644 index d1036da19..000000000 --- a/projects/oblique/jest.config.prod.js +++ /dev/null @@ -1,181 +0,0 @@ -'use strict'; - -module.exports = require('./jest.config'); -module.exports.testResultsProcessor = 'jest-sonar-reporter'; -module.exports.collectCoverageFrom = [ - '/projects/oblique/src/lib/**/*.ts', - '!**/_mocks/**', - '!**/*.module.ts', - '!**/**.harness.ts', - '!**/index.ts', - // the following files have no spec files and therefore have a 0 coverage. Tests will be written later - '!**/http-api-interceptor.ts', - '!**/off-canvas-container.directive.ts', - '!**/schema-required.directive.ts' -]; -module.exports.coverageThreshold = { - /* - * "global" combines all files that are not covered by another rules. The thresholds do not apply per file but globally. - * This means the global coverage might be sufficient even if a specific file has too weak a coverage. - */ - global: { - statements: 100, - branches: 100, - functions: 100, - lines: 100 - }, - // The following rules do apply to all target files individually - 'projects/oblique/src/lib/breadcrumb/*.ts': { - statements: 98, - branches: 78, - functions: 95, - lines: 98 - }, - 'projects/oblique/src/lib/button/*.ts': { - statements: 100, - branches: 76, - functions: 100, - lines: 100 - }, - 'projects/oblique/src/lib/checkbox/*.ts': { - statements: 90, - branches: 60, - functions: 70, - lines: 90 - }, - 'projects/oblique/src/lib/collapse/*.ts': { - statements: 100, - branches: 81, - functions: 100, - lines: 100 - }, - 'projects/oblique/src/lib/column-layout/column-layout.component.ts': { - branches: 94 - }, - 'projects/oblique/src/lib/document-meta/*.ts': { - statements: 60, - branches: 7, - functions: 18, - lines: 59 - }, - 'projects/oblique/src/lib/error-messages/*.ts': { - statements: 52, - branches: 0, - functions: 11, - lines: 52 - }, - 'projects/oblique/src/lib/file-upload/progress/*.ts': { - statements: 100, - branches: 88, - functions: 100, - lines: 100 - }, - 'projects/oblique/src/lib/http-api-interceptor/*.ts': { - statements: 25, - branches: 0, - functions: 0, - lines: 21 - }, - 'projects/oblique/src/lib/icon/*.ts': { - statements: 96, - branches: 75, - functions: 100, - lines: 95 - }, - 'projects/oblique/src/lib/input-clear/*.ts': { - statements: 96, - branches: 85, - functions: 100, - lines: 95 - }, - 'projects/oblique/src/lib/master-layout/*.ts': { - statements: 93, - branches: 66, - functions: 80, - lines: 91 - }, - 'projects/oblique/src/lib/master-layout/master-layout/*.ts': { - statements: 87, - branches: 56, - functions: 74, - lines: 86 - }, - 'projects/oblique/src/lib/master-layout/master-layout-header/*.ts': { - statements: 82, - branches: 65, - functions: 75, - lines: 82 - }, - 'projects/oblique/src/lib/master-layout/master-layout-navigation/*.ts': { - statements: 65, - branches: 53, - functions: 53, - lines: 65 - }, - 'projects/oblique/src/lib/master-layout/master-layout-navigation/sub-menu-item/*.ts': { - statements: 80, - branches: 88, - functions: 90, - lines: 80 - }, - 'projects/oblique/src/lib/multi-translate-loader/*.ts': { - statements: 22, - branches: 0, - functions: 0, - lines: 25 - }, - 'projects/oblique/src/lib/nav-tree/*.ts': { - statements: 91, - branches: 72, - functions: 96, - lines: 91 - }, - 'projects/oblique/src/lib/nested-form/*.ts': { - statements: 66, - branches: 90, - functions: 25, - lines: 63 - }, - 'projects/oblique/src/lib/notification/*.ts': { - statements: 90, - branches: 77, - functions: 78, - lines: 96 - }, - 'projects/oblique/src/lib/number-format/*.ts': { - statements: 82, - branches: 77, - functions: 85, - lines: 81 - }, - 'projects/oblique/src/lib/off-canvas/*.ts': { - statements: 70, - branches: 77, - functions: 33, - lines: 66 - }, - 'projects/oblique/src/lib/schema-validation/*.ts': { - statements: 79, - branches: 69, - functions: 75, - lines: 79 - }, - 'projects/oblique/src/lib/scrolling/*.ts': { - statements: 33, - branches: 83, - functions: 0, - lines: 27 - }, - 'projects/oblique/src/lib/selectable/*.ts': { - statements: 100, - branches: 81, - functions: 100, - lines: 100 - }, - 'projects/oblique/src/lib/sticky/*.ts': { - statements: 93, - branches: 85, - functions: 100, - lines: 95 - } -}; diff --git a/projects/oblique/package.json b/projects/oblique/package.json index ad222dc5e..af3de2459 100644 --- a/projects/oblique/package.json +++ b/projects/oblique/package.json @@ -8,6 +8,7 @@ "lint": "ts-node scripts/lint.ts", "format": "ts-node scripts/lint.ts --fix", "test": "cd ../.. && ng test oblique", + "test-ci": "cd ../.. && ng run oblique:test:ci", "test-debugging": "cd ../.. && node --expose-gc ../../node_modules/@angular/cli/bin/ng test oblique --log-heap-usage", "prebuild": "ts-node scripts/pre-dist/run-pre-dist-steps.ts && ng build oblique-styles", "build": "ng build oblique && npm run schematics", diff --git a/sonar-project.properties b/sonar-project.properties index 9bb334a76..eb7e63228 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,5 +1,5 @@ -sonar.typescript.lcov.reportPaths=./coverage/lcov.info -sonar.testExecutionReportPaths=./coverage/sqr.xml +sonar.typescript.lcov.reportPaths=./coverage/oblique/lcov.info +sonar.testExecutionReportPaths=./coverage/oblique/sqr.xml sonar.tests=./projects/oblique/src/lib sonar.sources=./projects/oblique/src sonar.exclusions=**/_mocks/* From 41b9cff0ef809358ee30250bebce386f519107dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 29 Apr 2024 23:48:55 +0200 Subject: [PATCH 04/33] refactor(sandbox/toolchain): create a "default" test configuration The "default" configuration replaces the previous unnamed one. It matches the structure of the Oblique test configuration and is called through the `test` script. It also makes sure the coverage is collected into a dedicated repository. OUI-3062 --- angular.json | 9 +++++++-- projects/sandbox/jest.config.js | 16 ++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/angular.json b/angular.json index 9898bf800..06a26fd6f 100644 --- a/angular.json +++ b/angular.json @@ -195,11 +195,16 @@ "test": { "builder": "@angular-builders/jest:run", "options": { - "configPath": "jest.config.js", "tsConfig": "tsconfig.spec.json", "no-cache": ["true"], "run-in-band": ["true"] - } + }, + "configurations": { + "default": { + "configPath": "jest.config.js" + } + }, + "defaultConfiguration": "default" } } }, diff --git a/projects/sandbox/jest.config.js b/projects/sandbox/jest.config.js index 5bcc8c3a1..31a473e4a 100644 --- a/projects/sandbox/jest.config.js +++ b/projects/sandbox/jest.config.js @@ -2,17 +2,13 @@ module.exports = require('../../tests/jest.config'); module.exports.roots = ['/projects/sandbox']; -module.exports.moduleNameMapper = { - '@oblique/oblique': '/projects/oblique/src/public_api.ts', - '@oblique/version': '/projects/oblique/src/lib/version.ts' -}; module.exports.displayName = { name: 'Sandbox', color: 'magenta' }; -module.exports.coveragePathIgnorePatterns = [ - '/node_modules/', - '/projects/oblique', - '/projects/stylesBuilder', - '/tests/' -]; +module.exports.moduleNameMapper = { + '@oblique/oblique': '/projects/oblique/src/public_api.ts', + '@oblique/version': '/projects/oblique/src/lib/version.ts' +}; +module.exports.coverageDirectory = '/coverage/sandbox'; +module.exports.coveragePathIgnorePatterns = ['/projects/oblique']; From 09092477bef217a017351c18a98f96b1e3c822d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 29 Apr 2024 22:45:56 +0200 Subject: [PATCH 05/33] refactor(sandbox/toolchain): create a "ci" test configuration The "ci" configuration is called through the `test-ci`script. It extends the "default" configuration, but it doesn't collect coverage OUI-3062 --- angular.json | 3 +++ projects/sandbox/jest.config.ci.js | 4 ++++ projects/sandbox/package.json | 1 + 3 files changed, 8 insertions(+) create mode 100644 projects/sandbox/jest.config.ci.js diff --git a/angular.json b/angular.json index 06a26fd6f..e0476ecb9 100644 --- a/angular.json +++ b/angular.json @@ -202,6 +202,9 @@ "configurations": { "default": { "configPath": "jest.config.js" + }, + "ci": { + "configPath": "jest.config.ci.js" } }, "defaultConfiguration": "default" diff --git a/projects/sandbox/jest.config.ci.js b/projects/sandbox/jest.config.ci.js new file mode 100644 index 000000000..4bb84086b --- /dev/null +++ b/projects/sandbox/jest.config.ci.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./jest.config'); +module.exports.collectCoverage = false; diff --git a/projects/sandbox/package.json b/projects/sandbox/package.json index 8911cd933..0f30b8dc9 100644 --- a/projects/sandbox/package.json +++ b/projects/sandbox/package.json @@ -7,6 +7,7 @@ "lint": "ts-node scripts/lint.ts", "format": "ts-node scripts/lint.ts --fix", "test": "cd ../.. && ng test sandbox", + "test-ci": "cd ../.. && ng run sandbox:test:ci", "build": "ng build" }, "dependencies": { From 9a28954a46a1a218d94e0d4a5c020bf3e58fc4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 29 Apr 2024 23:57:50 +0200 Subject: [PATCH 06/33] refactor(sds/toolchain): create a "default" test configuration The "default" configuration replaces the previous unnamed one. It matches the structure of the Oblique test configuration and is called through the `test` script. It also makes sure the coverage is collected into a dedicated repository. OUI-3062 --- angular.json | 8 +++++++- projects/sds/jest.config.js | 10 ++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/angular.json b/angular.json index e0476ecb9..15837ab80 100644 --- a/angular.json +++ b/angular.json @@ -317,7 +317,13 @@ "tsConfig": "tsconfig.spec.json", "no-cache": ["true"], "run-in-band": ["true"] - } + }, + "configurations": { + "default": { + "configPath": "jest.config.js" + } + }, + "defaultConfiguration": "default" } } }, diff --git a/projects/sds/jest.config.js b/projects/sds/jest.config.js index d1afaadb6..a91cdd590 100644 --- a/projects/sds/jest.config.js +++ b/projects/sds/jest.config.js @@ -2,6 +2,10 @@ module.exports = require('../../tests/jest.config'); module.exports.roots = ['/projects/sds']; +module.exports.displayName = { + name: 'SDS', + color: 'gray' +}; module.exports.moduleNameMapper = { '^content(.*)$': '/src/app/content$1', '^cms(.*)$': '/src/app/cms$1', @@ -15,7 +19,5 @@ module.exports.testPathIgnorePatterns = [ '/projects/sds/schematics/src/add-code-example/templates', '/projects/sds/schematics/src/add-preview/templates' ]; -module.exports.displayName = { - name: 'SDS', - color: 'gray' -}; +module.exports.coverageDirectory = '/coverage/sds'; +module.exports.coveragePathIgnorePatterns = ['/projects/oblique']; From 7378fc0887e80ef66f97b3dfbd5729da347e04b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 29 Apr 2024 22:48:48 +0200 Subject: [PATCH 07/33] refactor(sds/toolchain): create a "ci" test configuration The "ci" configuration is called through the `test-ci`script. It extends the "default" configuration, but it doesn't collect coverage OUI-3062 --- angular.json | 3 +++ projects/sds/jest.config.ci.js | 4 ++++ projects/sds/package.json | 1 + 3 files changed, 8 insertions(+) create mode 100644 projects/sds/jest.config.ci.js diff --git a/angular.json b/angular.json index 15837ab80..ad46277c5 100644 --- a/angular.json +++ b/angular.json @@ -321,6 +321,9 @@ "configurations": { "default": { "configPath": "jest.config.js" + }, + "ci": { + "configPath": "jest.config.ci.js" } }, "defaultConfiguration": "default" diff --git a/projects/sds/jest.config.ci.js b/projects/sds/jest.config.ci.js new file mode 100644 index 000000000..4bb84086b --- /dev/null +++ b/projects/sds/jest.config.ci.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./jest.config'); +module.exports.collectCoverage = false; diff --git a/projects/sds/package.json b/projects/sds/package.json index b5da0ff84..0d2fd7200 100644 --- a/projects/sds/package.json +++ b/projects/sds/package.json @@ -6,6 +6,7 @@ "lint": "ts-node scripts/lint.ts", "format": "ts-node scripts/lint.ts --fix", "test": "cd ../.. && ng test sds", + "test-ci": "cd ../.. && ng run sds:test:ci", "build": "ng build && ts-node scripts/post-dist/copy-nginx.ts", "add-code-example": "npm run schematics-build && cd ../../ && schematics ./projects/sds/schematics/collection:add-code-example --dry-run=false", "add-preview": "npm run schematics-build && cd ../../ && schematics ./projects/sds/schematics/collection:add-preview --dry-run=false", From a0d58008493eeb8a73d726db95c9daa69b217496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Tue, 30 Apr 2024 00:03:11 +0200 Subject: [PATCH 08/33] refactor(service-navigation): create a "default" test configuration The "default" configuration replaces the previous unnamed one. It matches the structure of the Oblique test configuration and is called through the `test` script. It also makes sure the coverage is collected into a dedicated repository. OUI-3062 --- angular.json | 8 +++++++- .../jest.config.js | 16 ++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/angular.json b/angular.json index ad46277c5..68bca5bb5 100644 --- a/angular.json +++ b/angular.json @@ -411,7 +411,13 @@ "tsConfig": "tsconfig.spec.json", "no-cache": ["true"], "run-in-band": ["true"] - } + }, + "configurations": { + "default": { + "configPath": "jest.config.js" + } + }, + "defaultConfiguration": "default" } } } diff --git a/projects/service-navigation-web-component/jest.config.js b/projects/service-navigation-web-component/jest.config.js index 85ba7a929..fb8cdb700 100644 --- a/projects/service-navigation-web-component/jest.config.js +++ b/projects/service-navigation-web-component/jest.config.js @@ -2,17 +2,13 @@ module.exports = require('../../tests/jest.config'); module.exports.roots = ['/projects/service-navigation-web-component']; -module.exports.moduleNameMapper = { - '@oblique/oblique': '/projects/oblique/src/public_api.ts', - '@oblique/version': '/projects/oblique/src/lib/version.ts' -}; module.exports.displayName = { name: 'Service Navigation Web Component', color: 'magenta' }; -module.exports.coveragePathIgnorePatterns = [ - '/node_modules/', - '/projects/oblique', - '/projects/stylesBuilder', - '/tests/' -]; +module.exports.moduleNameMapper = { + '@oblique/oblique': '/projects/oblique/src/public_api.ts', + '@oblique/version': '/projects/oblique/src/lib/version.ts' +}; +module.exports.coverageDirectory = '/coverage/service-navigation'; +module.exports.coveragePathIgnorePatterns = ['/projects/oblique']; From 8fa04d3bb16dbb1279887343e5470e00c4b67cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 29 Apr 2024 22:55:36 +0200 Subject: [PATCH 09/33] refactor(service-navigation): create a "ci" test configuration The "ci" configuration is called through the `test-ci`script. It extends the "default" configuration, but it doesn't collect coverage OUI-3062 --- angular.json | 3 +++ projects/service-navigation-web-component/jest.config.ci.js | 4 ++++ projects/service-navigation-web-component/package.json | 1 + 3 files changed, 8 insertions(+) create mode 100644 projects/service-navigation-web-component/jest.config.ci.js diff --git a/angular.json b/angular.json index 68bca5bb5..34155a977 100644 --- a/angular.json +++ b/angular.json @@ -415,6 +415,9 @@ "configurations": { "default": { "configPath": "jest.config.js" + }, + "ci": { + "configPath": "jest.config.ci.js" } }, "defaultConfiguration": "default" diff --git a/projects/service-navigation-web-component/jest.config.ci.js b/projects/service-navigation-web-component/jest.config.ci.js new file mode 100644 index 000000000..4bb84086b --- /dev/null +++ b/projects/service-navigation-web-component/jest.config.ci.js @@ -0,0 +1,4 @@ +'use strict'; + +module.exports = require('./jest.config'); +module.exports.collectCoverage = false; diff --git a/projects/service-navigation-web-component/package.json b/projects/service-navigation-web-component/package.json index b0e7cd4dc..36a319dff 100644 --- a/projects/service-navigation-web-component/package.json +++ b/projects/service-navigation-web-component/package.json @@ -9,6 +9,7 @@ "lint": "ts-node scripts/lint.ts", "format": "ts-node scripts/lint.ts --fix", "test": "cd ../.. && ng test service-navigation-web-component", + "test-ci": "cd ../.. && ng run service-navigation-web-component:test:ci", "build": "ng build && ts-node scripts/post-dist" }, "keywords": [ From 37a954679db617cf65a72c7a0f08a026023c00f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Tue, 30 Apr 2024 00:24:51 +0200 Subject: [PATCH 10/33] refactor(toolchain): let jenkins call `test-ci` instead of `test` OUI-3062 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 551fa9b68..c1adbfcc7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ nodejsPipelineTemplate { branches = [ '*': [ 'lint': 'npm run lint', - 'test': 'npm test -ws', + 'test': 'npm run test-ci -ws', 'build': 'npm run build -ws', sonar: true ], From 12a5c000f8996431d09c2776e0364de5a53e7b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Fri, 3 May 2024 11:36:56 +0200 Subject: [PATCH 11/33] fix(toolchain): update tested node versions on github actions OUI-3074 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 979179108..255eac870 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x] + node-version: [18.x, 20.x, 22.x] # Steps represent a sequence of tasks that will be executed as part of the job steps: From a75711390e8e69c00a6df5e2a5f82b502d5e8466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Fri, 3 May 2024 11:38:00 +0200 Subject: [PATCH 12/33] fix(toolchain): use workspace commands for github actions OUI-3074 --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 255eac870..7dca6c44e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,6 +31,5 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm ci - run: npm run lint - - run: npm run test - - run: npm run build - - run: npm run dist + - run: npm run test -ws + - run: npm run build -ws From d324233e8de9f63ae8bcc42bc29fec468f804b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Mon, 6 May 2024 08:36:16 +0200 Subject: [PATCH 13/33] fix(toolchain): update github actions to v4 OUI-3074 --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7dca6c44e..4ba713307 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,9 +24,9 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm ci From c23bf8ef80e805d75a950103ac0c00c9e28e63c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Fri, 3 May 2024 15:10:33 +0200 Subject: [PATCH 14/33] feat(sandbox/autocomplete): add reset control button OUI-2396 --- .../src/app/samples/autocomplete/autocomplete.component.html | 4 ++++ .../src/app/samples/autocomplete/autocomplete.component.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.html b/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.html index 5f60186ba..533941dd6 100644 --- a/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.html +++ b/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.html @@ -62,6 +62,10 @@

Controls

> +
+ Reset control + +
Icon position in options diff --git a/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.ts b/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.ts index 6276239eb..c1572a67b 100644 --- a/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.ts +++ b/projects/sandbox/src/app/samples/autocomplete/autocomplete.component.ts @@ -79,6 +79,10 @@ formControl = new FormControl(''); this.updateVisibleOptionList(); } + reset(): void { + this.formControl.reset(); + } + createOptionGroupList(amount: number, disabled = false): ObIAutocompleteInputOptionGroup[] { const optionGroupList = []; for (let index = 0; index < amount; index++) { From fd98c04ca1b0ed068e21562b960997c5baac60f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Giller?= Date: Fri, 3 May 2024 15:24:04 +0200 Subject: [PATCH 15/33] fix(oblique/autocomplete): reset options list when the formControl is reset OUI-2396 --- .../src/lib/autocomplete/autocomplete.component.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/oblique/src/lib/autocomplete/autocomplete.component.ts b/projects/oblique/src/lib/autocomplete/autocomplete.component.ts index eea155c46..c7d148a7c 100644 --- a/projects/oblique/src/lib/autocomplete/autocomplete.component.ts +++ b/projects/oblique/src/lib/autocomplete/autocomplete.component.ts @@ -61,6 +61,7 @@ export class ObAutocompleteComponent implements OnChanges, ControlValueAccessor, filteredOptions$: Observable<(ObIAutocompleteInputOption | ObIAutocompleteInputOptionGroup)[]>; hasGroupOptions = false; private readonly unsubscribe = new Subject(); + private readonly unsubscribeOptions = new Subject(); private readonly obAutocompleteTextToFindService = inject(ObAutocompleteTextToFindService); ngOnChanges(): void { @@ -70,6 +71,8 @@ export class ObAutocompleteComponent implements OnChanges, ControlValueAccessor, ngOnDestroy(): void { this.unsubscribe.next(); this.unsubscribe.complete(); + this.unsubscribeOptions.next(); + this.unsubscribeOptions.complete(); } setDisabledState(isDisabled: boolean): void { @@ -93,6 +96,11 @@ export class ObAutocompleteComponent implements OnChanges, ControlValueAccessor, */ writeValue(value: string): void { this.autocompleteInputControl.setValue(value, {emitEvent: false}); + // when the value is reset, the options should also be reset + if (value === null || value === undefined) { + this.unsubscribeOptions.next(); // kill the current stream before creating a new one + this.setupOptionsFilter(); + } } /** @@ -116,6 +124,7 @@ export class ObAutocompleteComponent implements OnChanges, ControlValueAccessor, private setupOptionsFilter(): void { this.filteredOptions$ = this.autocompleteInputControl.valueChanges.pipe( + takeUntil(this.unsubscribeOptions), startWith(''), debounceTime(200), map((searchValue: string) => { From 26a88fb238e7be3b56921d551d1466959414baaf Mon Sep 17 00:00:00 2001 From: Nina Egger Date: Wed, 8 May 2024 15:42:57 +0200 Subject: [PATCH 16/33] fix(oblique/schematics): prevent browser compatibility warning being shown in google search OUI-3051 --- .../index/ng-add/templates/default-index.html | 7 ++++++- .../index/ng-update/update-v10-to-v11.ts | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/projects/oblique/schematics/index/ng-add/templates/default-index.html b/projects/oblique/schematics/index/ng-add/templates/default-index.html index b6205abb7..5ecf97f86 100644 --- a/projects/oblique/schematics/index/ng-add/templates/default-index.html +++ b/projects/oblique/schematics/index/ng-add/templates/default-index.html @@ -18,7 +18,12 @@ -