Skip to content

Commit 0336bf3

Browse files
committed
chore: Added Vitest GitHub workflow
chore: Added Vitest GitHub workflow
1 parent 6141908 commit 0336bf3

File tree

6 files changed

+417
-90
lines changed

6 files changed

+417
-90
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test frontend
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- stable
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
run-vitest:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v4
16+
17+
- uses: pnpm/action-setup@v4
18+
with:
19+
version: 9
20+
run_install: false
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: "20"
25+
cache: "pnpm"
26+
cache-dependency-path: pnpm-lock.yaml
27+
28+
- name: Install and Build
29+
run: |
30+
(cd frontend && pnpm install);
31+
make .install-logos
32+
API_URL="https://prod.packit.dev/api" make transpile-prod
33+
34+
- name: Run Vitest
35+
run: make test_frontend_coverage

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ test_image: files/ansible/install-deps.yaml files/ansible/recipe-tests.yaml
6161
test_frontend:
6262
cd frontend && pnpm run test
6363

64+
test_frontend_coverage:
65+
cd frontend && pnpm run coverage
66+
6467
check_in_container: test_image
6568
$(CONTAINER_ENGINE) run --rm \
6669
--security-opt label=disable \

frontend/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"build": "vite build",
4444
"build:analyze": "vite-bundle-visualizer --open",
4545
"preview": "vite preview",
46-
"test": "vitest"
46+
"test": "vitest",
47+
"coverage": "vitest run --coverage"
4748
},
4849
"browserslist": {
4950
"production": [
@@ -61,7 +62,8 @@
6162
"@biomejs/biome": "1.8.3",
6263
"babel-plugin-named-exports-order": "^0.0.2",
6364
"prop-types": "^15.8.1",
64-
"vitest": "^2.1.2"
65+
"vitest": "^2.1.5",
66+
"@vitest/coverage-v8": "^2.1.5"
6567
},
6668
"engines": {
6769
"node": ">=20",

frontend/src/components/statusLabels/__snapshots__/BaseStatusLabel.test.tsx.snap

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,37 @@ exports[`default label > default label 1`] = `
1010
style="padding: 2px;"
1111
>
1212
<span
13-
class="pf-v5-c-label pf-m-blue"
13+
class="pf-v6-c-label pf-m-blue pf-m-filled"
1414
>
1515
<span
16-
class="pf-v5-c-label__icon"
16+
class="pf-v6-c-label__content"
1717
>
18-
<svg
19-
aria-hidden="true"
20-
class="pf-v5-svg"
21-
fill="currentColor"
22-
height="1em"
23-
role="img"
24-
viewBox="0 0 448 512"
25-
width="1em"
18+
<span
19+
class="pf-v6-c-label__icon"
2620
>
27-
<path
28-
d="M368 160h-.94a144 144 0 1 0-286.12 0H80a48 48 0 0 0 0 96h288a48 48 0 0 0 0-96zM195.38 493.69a31.52 31.52 0 0 0 57.24 0L352 288H96z"
29-
/>
30-
</svg>
31-
</span>
32-
<span
33-
class="pf-v5-c-label__text"
34-
>
35-
Label fsdf
21+
<svg
22+
aria-hidden="true"
23+
class="pf-v6-svg"
24+
fill="currentColor"
25+
height="1em"
26+
role="img"
27+
viewBox="0 0 448 512"
28+
width="1em"
29+
>
30+
<path
31+
d="M368 160h-.94a144 144 0 1 0-286.12 0H80a48 48 0 0 0 0 96h288a48 48 0 0 0 0-96zM195.38 493.69a31.52 31.52 0 0 0 57.24 0L352 288H96z"
32+
/>
33+
</svg>
34+
</span>
3635
<span
37-
class="pf-v5-u-screen-reader"
36+
class="pf-v6-c-label__text"
3837
>
39-
tooltipText
38+
Label fsdf
39+
<span
40+
class="pf-v6-u-screen-reader"
41+
>
42+
tooltipText
43+
</span>
4044
</span>
4145
</span>
4246
</span>

frontend/vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,11 @@ export default defineConfig(() => ({
5050
},
5151
test: {
5252
environment: "happy-dom",
53+
reporters: process.env.GITHUB_ACTIONS ? ['dot', 'github-actions'] : ['dot'],
54+
include: ["src"],
5355
},
56+
coverage: {
57+
provider: "v8",
58+
include: ["src"]
59+
}
5460
}));

0 commit comments

Comments
 (0)