Skip to content

Commit

Permalink
chore: change coverage CI
Browse files Browse the repository at this point in the history
Signed-off-by: Nam Hoang <[email protected]>
  • Loading branch information
namhoang1604 committed Oct 25, 2024
1 parent e91c0ef commit 34fcfbc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ jobs:
run: |
yarn test:coverage
- run: cat coverage/coverage-final.json
- name: Coverage
uses: artiomtr/jest-coverage-[email protected]
- name: Jest Coverage Comment
uses: MishaKav/jest-coverage-comment@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage-file: coverage/coverage-final.json
base-coverage-file: coverage/coverage-final.json
threshold: 80
title: Code Coverage Report
multiple-files: |
All packages, ./coverage/coverage-summary.json
Components, ./packages/components/coverage/coverage-summary.json
Mock app, ./packages/mock-app/coverage/coverage-summary.json
Services, ./packages/services/coverage/coverage-summary.json
UNTP test suite, ./packages/untp-test-suite/coverage/coverage-summary.json
VC test suite, ./packages/vc-test-suite/coverage/coverage-summary.json
4 changes: 2 additions & 2 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}', '!**/*.d.ts'],
collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}', '<rootDir>/src/**/*.{js,jsx}', '!**/*.d.ts'],
coverageDirectory: '<rootDir>/coverage',
coverageReporters: ['json', 'text', 'lcov'],
coverageReporters: ['json', 'json-summary', 'text', 'lcov'],
verbose: true,
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "mock-app",
"version": "1.0.0",
"private": true,
"workspaces": ["packages/*"],
"workspaces": [
"packages/*"
],
"scripts": {
"start": "cp app-config.json packages/mock-app/src/constants/app-config.json && cd packages/mock-app && yarn start",
"build": "yarn build:services && yarn build:components && yarn build:untp-test-suite",
Expand All @@ -11,7 +13,7 @@
"build:untp-test-suite": "cd packages/untp-test-suite && yarn run build",
"build-clean": "rimraf --glob ./yarn.lock ./node_modules ./packages/*/tsconfig.tsbuildinfo ./packages/*/build ./packages/*/node_modules",
"test": "lerna exec -- yarn jest",
"test:coverage": "lerna exec -- yarn jest --coverage && istanbul-merge --out coverage/coverage-final.json packages/*/coverage/coverage-final.json && nyc report --reporter=html --temp-dir=./coverage",
"test:coverage": "lerna exec -- yarn jest --coverage && istanbul-merge --out coverage/coverage-final.json packages/*/coverage/coverage-final.json && nyc report --temp-dir=./coverage --reporter=html --reporter=json-summary",
"test:components": "cd packages/components && yarn run test",
"test:services": "cd packages/services && yarn run test",
"test:mock-app": "cd packages/mock-app && yarn run test",
Expand Down
2 changes: 1 addition & 1 deletion packages/untp-test-suite/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
moduleFileExtensions: [...defaults.moduleFileExtensions, 'mts'],
collectCoverage: false,
collectCoverageFrom: ['!**/examples/**', '!**/types/**', '!**/build/**', '!**/node_modules/**', '!**/**/index.ts'],
coverageReporters: ['text', 'lcov', 'json'],
coverageReporters: ['text', 'lcov', 'json', 'json-summary'],
coverageProvider: 'v8',
coverageDirectory: './coverage',
extensionsToTreatAsEsm: ['.ts'],
Expand Down

0 comments on commit 34fcfbc

Please sign in to comment.