diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f1a0af..cbc4de6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,13 +41,24 @@ jobs: with: files: ./coverage/lcov.info # cSpell: ignore lcov #token: ${{ secrets.CODECOV_TOKEN }} - #token: ${{ env.CODECOV_TOKEN }} + token: ${{ env.CODECOV_TOKEN }} flags: unittests # cSpell: ignore unittests name: relabeler-tests verbose: true fail_ci_if_error: true - env: - CODECOV_TOKEN: ${{ vars.CODECOV_TOKEN }} + #env: + # CODECOV_TOKEN: ${{ vars.CODECOV_TOKEN }} + + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + files: ./testResults/junit.xml + flags: unittests + name: relabeler-tests-results + verbose: true + fail_ci_if_error: true + token: ${{ env.CODECOV_TOKEN }} - name: Create artifact run: | diff --git a/.gitignore b/.gitignore index ba2a97b..d5cd775 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules coverage +testResults diff --git a/jest.config.mjs b/jest.config.mjs index f6097fa..23c0475 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -5,6 +5,10 @@ export default { transform: { '^.+\\.tsx?$': ['ts-jest', {}], }, + reporters: [ + "default", + "jest-junit" + ], collectCoverage: true, coverageDirectory: 'coverage', coverageReporters: ['lcov', 'text', 'cobertura'], // Generates both LCOV and Cobertura reports diff --git a/package-lock.json b/package-lock.json index a670486..e385947 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "eslint": "^8.55.0", "globals": "^13.24.0", "jest": "^29.7.0", + "jest-junit": "^16.0.0", "license-checker": "^25.0.1", "ts-jest": "^29.1.1", "typescript": "5.3.3", @@ -3934,6 +3935,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", @@ -6238,6 +6268,13 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "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/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 7014ba0..5f13791 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "main": "dist/index.js", "scripts": { "clean": "rm -rf dist", - "clean:coverage": "rm -rf coverage", + "clean:coverage": "rm -rf coverage testResults", "build": "npm run clean && npx ncc build src/index.ts -o dist --source-map --license licenses.txt", "test": "npm run clean:coverage && jest --coverage --verbose --detectOpenHandles && npm run lint", "lint": "eslint 'src/**/*.{ts,js}'", @@ -23,6 +23,7 @@ "devDependencies": { "typescript": "5.3.3", "jest": "^29.7.0", + "jest-junit": "^16.0.0", "ts-jest": "^29.1.1", "@types/jest": "^29.5.11", "@types/axios": "^0.14.0", @@ -37,5 +38,12 @@ "@types/js-yaml": "^4.0.5", "license-checker": "^25.0.1", "@vercel/ncc": "^0.38.1" + }, + "jest-junit": { + "suiteName": "Relabeler Tests", + "outputDirectory": "testResults", + "outputName": "junit.xml", + "reportTestSuiteErrors": "true", + "includeConsoleOutput": "true" } }