Skip to content

Commit f49b435

Browse files
committed
feat: add lighthouse accessibility testing job to CI
1 parent be9ae01 commit f49b435

5 files changed

Lines changed: 1711 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,23 @@ jobs:
7373

7474
- name: 🖥️ Test project (browser)
7575
run: pnpm test:browser
76+
77+
a11y:
78+
runs-on: ubuntu-latest
79+
80+
steps:
81+
- uses: actions/checkout@v6
82+
- run: corepack enable
83+
- uses: actions/setup-node@v6
84+
with:
85+
node-version: lts/*
86+
cache: pnpm
87+
88+
- name: 📦 Install dependencies
89+
run: pnpm install
90+
91+
- name: 🏗️ Build project
92+
run: pnpm build
93+
94+
- name: ♿ Accessibility audit (Lighthouse)
95+
run: pnpm lhci

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ coverage/
3333
# Playwright
3434
playwright-report/
3535
test-results/
36+
37+
# Lighthouse
38+
.lighthouseci

.lighthouserc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"startServerCommand": "pnpm preview",
5+
"startServerReadyPattern": "Listening",
6+
"url": [
7+
"http://localhost:3000/",
8+
"http://localhost:3000/search?q=nuxt",
9+
"http://localhost:3000/nuxt"
10+
],
11+
"numberOfRuns": 1,
12+
"settings": {
13+
"onlyCategories": ["accessibility"],
14+
"skipAudits": ["valid-source-maps"]
15+
}
16+
},
17+
"assert": {
18+
"assertions": {
19+
"categories:accessibility": ["warn", { "minScore": 0.9 }]
20+
}
21+
},
22+
"upload": {
23+
"target": "temporary-public-storage"
24+
}
25+
}
26+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"test:browser:update": "playwright test --update-snapshots",
2424
"test:nuxt": "vitest --project nuxt",
2525
"test:types": "nuxt prepare && vue-tsc -b --noEmit && pnpm --filter npmx-connector test:types",
26-
"test:unit": "vitest --project unit"
26+
"test:unit": "vitest --project unit",
27+
"lhci": "lhci autorun"
2728
},
2829
"dependencies": {
2930
"@iconify-json/simple-icons": "^1.2.67",
@@ -52,6 +53,7 @@
5253
"devDependencies": {
5354
"@iconify-json/carbon": "1.2.18",
5455
"@iconify-json/solar": "1.2.5",
56+
"@lhci/cli": "0.15.1",
5557
"@npm/types": "2.1.0",
5658
"@nuxt/test-utils": "https://pkg.pr.new/@nuxt/test-utils@1499a48",
5759
"@playwright/test": "1.57.0",

0 commit comments

Comments
 (0)