Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WD-17076 - chore(ci): add UI test coverage reporter #470

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ui-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Report UI Coverage
on:
workflow_run:
workflows: ["UI"]
types:
- completed
jobs:
report:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: "Report Coverage"
uses: davelosert/vitest-coverage-report-action@v2
with:
working-directory: "./ui"
name: "UI Test Coverage"
13 changes: 12 additions & 1 deletion .github/workflows/ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ on:
push:
branches:
- main
paths:
- 'ui/**'
pull_request:
branches:
- main
paths:
- 'ui/**'
jobs:
lint:
name: Lint
Expand All @@ -27,6 +31,8 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
node-version: [20.x]
Expand All @@ -40,7 +46,12 @@ jobs:
cache-dependency-path: ui/yarn.lock
- name: Install
run: yarn --cwd ui install --immutable
- run: yarn --cwd ui test-js
- run: yarn --cwd ui test-js --coverage.enabled true
- name: "Upload Coverage"
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage
build:
name: Build
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ dist/
/test-results/
/playwright-report/
/playwright/.cache/
coverage

haproxy-local.cfg
haproxy-local.cfg
3 changes: 2 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "2.1.5",
"autoprefixer": "10.4.19",
"axios-mock-adapter": "2.0.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
Expand All @@ -77,7 +78,7 @@
"vite": "5.2.8",
"vite-plugin-html": "3.2.2",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.2.1"
"vitest": "2.1.5"
},
"lint-staged": {
"src/**/*.{json,jsx,ts,tsx}": [
Expand Down
6 changes: 6 additions & 0 deletions ui/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ export default defineConfig((configEnv) =>
viteConfig({ ...configEnv, mode: "development" }),
defineConfig({
test: {
coverage: {
exclude: ["src/test/**", "**/*.d.ts"],
include: ["src/**/*.[jt]s?(x)"],
reporter: ["text", "json-summary", "json", "cobertura"],
reportOnFailure: true,
},
environment: "happy-dom",
globals: true,
include: ["./src/**/*.{test,spec}.{ts,tsx}"],
Expand Down
Loading
Loading