Skip to content

Commit

Permalink
Fix upload test result to codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Sep 8, 2024
1 parent 3425c5d commit 539f4db
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
coverage
testResults
4 changes: 4 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions package-lock.json

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

10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}'",
Expand All @@ -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",
Expand All @@ -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"
}
}

0 comments on commit 539f4db

Please sign in to comment.