diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index 14a047b2..4e1d30fb 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -86,7 +86,7 @@ jobs: -Dsonar.pullrequest.branch=${{ steps.pr.outputs.head_ref }} -Dsonar.pullrequest.base=${{ steps.pr.outputs.base_ref }} - - name: Publish Code Coverage + - name: Publish Coverage to Codecov uses: codecov/codecov-action@v4 with: override_pr: ${{ steps.pr.outputs.number }} @@ -96,6 +96,16 @@ jobs: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + - name: Publish Test Results to Codecov + uses: codecov/test-results-action@v1 + with: + override_pr: ${{ steps.pr.outputs.number }} + override_commit: ${{ steps.pr.outputs.head_sha }} + files: ./reports/junit.xml + flags: tests + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} + - name: Add comment to PR if job fails if: ${{ failure() }} uses: marocchino/sticky-pull-request-comment@v2 diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 1ec492ab..1f221600 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -64,6 +64,7 @@ jobs: coverage/lcov.info coverage/clover.xml reports/tests.xml + reports/junit.xml - name: SonarCloud (on push) uses: sonarsource/sonarcloud-github-action@v2 @@ -80,3 +81,12 @@ jobs: flags: tests fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + + - name: Codecov Test Results (on push) + uses: codecov/test-results-action@v1 + if: github.event_name == 'push' && matrix.node-version == env.node-version-analysis + with: + files: ./reports/junit.xml + flags: tests + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/jest.config.js b/jest.config.js index b306c2c0..312fa2e0 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,13 +3,24 @@ module.exports = { testEnvironment: 'node', setupFilesAfterEnv: ['jest-chain'], coverageReporters: ['json', 'lcov', 'text', 'clover'], - collectCoverageFrom : [ - 'src/**/*.ts', - '!src/docgen/*.ts', + collectCoverageFrom: ['src/**/*.ts', '!src/docgen/*.ts'], + reporters: [ + 'default', + [ + 'jest-sonar', + { + outputDirectory: 'reports', + outputName: 'tests.xml', + reportedFilePath: 'relative', + }, + ], + [ + 'jest-junit', + { + outputDirectory: 'reports', + outputName: 'junit.xml', + reportedFilePath: 'relative', + }, + ], ], - reporters: ['default', ['jest-sonar', { - outputDirectory: 'reports', - outputName: 'tests.xml', - reportedFilePath: 'relative', - }]], -}; \ No newline at end of file +}; diff --git a/package-lock.json b/package-lock.json index ac606d68..231d0ee2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,6 +43,7 @@ "jest": "^29.7.0", "jest-chain": "^1.1.6", "jest-each": "^29.7.0", + "jest-junit": "^16.0.0", "jest-mock-extended": "^3.0.5", "jest-sonar": "^0.2.16", "jest-when": "^3.6.0", @@ -7736,6 +7737,35 @@ "fsevents": "^2.3.2" } }, + "node_modules/jest-junit": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz", + "integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/jest-junit/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", @@ -11674,6 +11704,16 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -12027,6 +12067,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true, + "license": "MIT" + }, "node_modules/xml2js": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", @@ -17581,6 +17628,26 @@ "walker": "^1.0.8" } }, + "jest-junit": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz", + "integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==", + "dev": true, + "requires": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + } + } + }, "jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", @@ -20361,6 +20428,12 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true + }, "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -20618,6 +20691,12 @@ "integrity": "sha512-GCPAHLvrIH13+c0SuacwvRYj2SxJXQ4kaVTT5xgL3kPrz56XxkF21IGhjSE1+W0aw7gpBWRGXLCPnPby6lSpmQ==", "dev": true }, + "xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true + }, "xml2js": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz", diff --git a/package.json b/package.json index c0e0078b..2a7bedcd 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "jest": "^29.7.0", "jest-chain": "^1.1.6", "jest-each": "^29.7.0", + "jest-junit": "^16.0.0", "jest-mock-extended": "^3.0.5", "jest-sonar": "^0.2.16", "jest-when": "^3.6.0",