actions: frontend test coverage wordt gereport door de workflow
This commit is contained in:
		
							parent
							
								
									7058263085
								
							
						
					
					
						commit
						ae45ba7ca8
					
				
					 3 changed files with 23 additions and 1 deletions
				
			
		
							
								
								
									
										17
									
								
								.github/workflows/frontend-testing.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/frontend-testing.yml
									
										
									
									
										vendored
									
									
								
							|  | @ -38,6 +38,12 @@ jobs: | ||||||
|     if: '! github.event.pull_request.draft' |     if: '! github.event.pull_request.draft' | ||||||
|     runs-on: [self-hosted, Linux, X64] |     runs-on: [self-hosted, Linux, X64] | ||||||
| 
 | 
 | ||||||
|  |     permissions: | ||||||
|  |       # Required to checkout the code | ||||||
|  |       contents: read | ||||||
|  |       # Required to put a comment into the pull-request | ||||||
|  |       pull-requests: write | ||||||
|  | 
 | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|         node-version: [22.x] |         node-version: [22.x] | ||||||
|  | @ -51,4 +57,13 @@ jobs: | ||||||
|         node-version: ${{ matrix.node-version }} |         node-version: ${{ matrix.node-version }} | ||||||
|         cache: 'npm' |         cache: 'npm' | ||||||
|     - run: npm ci |     - run: npm ci | ||||||
|     - run: npm run test:unit -w frontend |     - run: npm run test:coverage -w frontend | ||||||
|  |     - name: 'Report Frontend Coverage' | ||||||
|  |       # Set if: always() to also generate the report if tests are failing | ||||||
|  |       # Only works if you set `reportOnFailure: true` in your vite config as specified above | ||||||
|  |       if: always()  | ||||||
|  |       uses:  davelosert/vitest-coverage-report-action@v2 | ||||||
|  |       with: | ||||||
|  |         name: 'Frontend' | ||||||
|  |         json-summary-path: './frontend/coverage/coverage-summary.json' | ||||||
|  |         json-final-path: './frontend/coverage/coverage-final.json' | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ | ||||||
|         "format-check": "prettier --check src/", |         "format-check": "prettier --check src/", | ||||||
|         "lint": "eslint . --fix", |         "lint": "eslint . --fix", | ||||||
|         "test:unit": "vitest --run", |         "test:unit": "vitest --run", | ||||||
|  |         "test:coverage": "vitest --run --coverage.enabled true", | ||||||
|         "test:e2e": "playwright test" |         "test:e2e": "playwright test" | ||||||
|     }, |     }, | ||||||
|     "dependencies": { |     "dependencies": { | ||||||
|  |  | ||||||
|  | @ -9,6 +9,12 @@ export default mergeConfig( | ||||||
|             environment: "jsdom", |             environment: "jsdom", | ||||||
|             exclude: [...configDefaults.exclude, "e2e/**"], |             exclude: [...configDefaults.exclude, "e2e/**"], | ||||||
|             root: fileURLToPath(new URL("./", import.meta.url)), |             root: fileURLToPath(new URL("./", import.meta.url)), | ||||||
|  |             coverage: { | ||||||
|  |                 reporter: ['text', 'json-summary', 'json'], | ||||||
|  |                 // If you want a coverage reports even if your tests are failing, include the reportOnFailure option
 | ||||||
|  |                 reportOnFailure: true, | ||||||
|  |                 exclude: ['**/*config*'], | ||||||
|  |               }, | ||||||
|         }, |         }, | ||||||
|     }), |     }), | ||||||
| ); | ); | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Timo De Meyst
						Timo De Meyst