build(test): run unit tests with vitest and jsdom

Karma needed headless Chrome. Vitest with jsdom runs with no browser.
Lighthouse CI now gets Chrome from @puppeteer/browsers.
Two CSS font tests are dropped: jsdom does not apply real CSS.
This commit is contained in:
lobo committed 2026-10-13 09:02:45 +02:00
1 parent dd7c9f6e3d
commit 4e59770e53
14 files changed
+751 -1865

No files matched your search

+5 -6
View File
@@ -26,6 +26,7 @@ jobs:
check-latest: true
cache: 'npm'
# Shared libraries for the Chrome that Lighthouse CI runs
- name: Install Linux Libs
run: |
sudo apt-get update
@@ -57,21 +58,19 @@ jobs:
- name: i18n Key Check
run: npm run i18n:check
# 3. Unit Tests (Logic) — browser/launcher configured in karma.conf.js
# 3. Unit Tests (Vitest + jsdom, no browser)
- name: Unit Tests
run: npx ng test --watch=false
run: npm test
# 4. Build Production (necessary for lighthouse)
- name: Build Production
run: npx ng build --configuration production
# 5. Lighthouse Audit (Performance & SEO)
# Puppeteer is a devDependency, so `npm ci` already installed it and
# downloaded Chrome. executablePath() is async in Puppeteer v25, so await it.
- name: Lighthouse CI
run: |
CHROME_PATH=$(node -e 'require("puppeteer").executablePath().then(p => console.log(p))')
export CHROME_PATH=$CHROME_PATH
CHROME_PATH=$(npx @puppeteer/browsers install chrome@stable --path "$RUNNER_TEMP/chrome" --format '{{path}}')
export CHROME_PATH
npx lhci autorun
# ------------------------------------------------------------------