chore: nightly full e2e and size limit tests
Some checks are pending
Tests / Unit (push) Waiting to run
Tests / E2E (push) Waiting to run

This commit is contained in:
ayo 2026-07-05 16:33:10 +02:00
parent b5b7008abf
commit f320e845bb
5 changed files with 79 additions and 36 deletions

49
.github/workflows/nightly.yml vendored Normal file
View file

@ -0,0 +1,49 @@
name: Nightly E2E
# The full cross-browser e2e matrix (Chromium + Firefox + WebKit) is heavy to
# set up (browser downloads + system deps), so it runs once a day instead of on
# every push/PR. Push/PR CI keeps a fast Chromium-only e2e gate (test.yml).
on:
schedule:
# 06:00 UTC daily
- cron: '0 6 * * *'
workflow_dispatch: # allow manual runs from the Actions tab
permissions:
contents: read
jobs:
e2e-all:
name: E2E (Chromium + Firefox + WebKit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
# Firefox/WebKit need system deps that `--with-deps` installs via apt.
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium firefox webkit
- run: pnpm test:e2e:all
size:
name: Size limit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
# `pnpm size-limit` builds `dist/` (tsc + esbuild) and checks each entry
# against the byte budgets declared in package.json `size-limit`.
- run: pnpm size-limit

View file

@ -16,7 +16,7 @@ permissions:
jobs:
unit:
name: Unit (happy-dom)
name: Unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@ -31,7 +31,7 @@ jobs:
- run: pnpm test
e2e:
name: E2E (Chromium + Firefox + WebKit)
name: E2E
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@ -43,25 +43,8 @@ jobs:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
# Downloads the browser binaries and their OS libraries (Firefox/WebKit
# need system deps that `--with-deps` installs via apt on the runner).
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium firefox webkit
- run: pnpm test:e2e:all
size:
name: Size limit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
# `pnpm size-limit` builds `dist/` (tsc + esbuild) and checks each entry
# against the byte budgets declared in package.json `size-limit`.
- run: pnpm size-limit
# Chromium only on push/PR — the full Firefox/WebKit matrix runs nightly
# (.github/workflows/nightly.yml).
- name: Install Playwright Chromium
run: pnpm exec playwright install --with-deps chromium
- run: pnpm test:e2e

View file

@ -1,5 +1,8 @@
# Lean: lint + format staged files, then the fast unit suite.
# Heavier checks (browser e2e, size-limit) run on pre-push; the full
# cross-browser matrix runs in CI.
# Everything runs at commit time. This repo auto-pushes to multiple remotes
# (github, forgejo, sourcehut — see post-commit), so a pre-push hook would
# re-run these once per remote; keeping them here runs them once per commit.
# The full cross-browser e2e matrix still runs nightly in CI. Order: cheap → expensive.
pnpm exec lint-staged
pnpm test
pnpm test:e2e
pnpm size-limit

View file

@ -1,4 +0,0 @@
# Heavier gate before code leaves the machine: browser e2e (Chromium only —
# Firefox/WebKit + their system deps are exercised in CI) and the size budget.
pnpm test:e2e
pnpm size-limit

View file

@ -18,12 +18,24 @@ pnpm test:e2e:webkit # WebKit (the engine behind Safari)
pnpm test:e2e:all # Chromium + Firefox + WebKit
pnpm test # fast unit suite (happy-dom), unchanged
pnpm test:all # unit + default e2e
pnpm test:all # unit + full e2e (all 3 engines)
```
`pnpm test:e2e` stays on Chromium so it works everywhere with minimal setup; use
`test:e2e:all` (or a CI matrix) for the full cross-browser run. Each script just
sets the `E2E_BROWSERS` env var (comma-separated), which the config reads.
`test:e2e:all` for the full cross-browser run. Each script just sets the
`E2E_BROWSERS` env var (comma-separated), which the config reads.
### Where each runs
| Stage | e2e scope |
| ----------------------------- | ----------------------------- |
| pre-commit | none (unit only) |
| pre-push | `test:e2e` (Chromium) |
| CI on push to `main` / PRs | `test:e2e` (Chromium) |
| CI nightly (`nightly.yml`) | `test:e2e:all` (all 3 engines) |
The full Firefox/WebKit matrix is heavy to provision, so it runs once a day
(and on-demand via **workflow_dispatch**) rather than on every push/PR.
Config lives in `vitest.e2e.config.mjs` (Vitest browser mode + the
`@vitest/browser-playwright` provider), kept separate from `vitest.config.mjs`
@ -38,8 +50,8 @@ npx playwright install-deps # Linux only: system libraries
Firefox and especially WebKit need extra OS libraries on Linux (`libwoff1`,
etc.); `playwright install-deps` requires root. Without them those engines fail
to launch — which is why the default target is Chromium and CI installs the deps
before running `test:e2e:all`.
to launch — which is why the default target is Chromium, and only the nightly
workflow installs the deps before running `test:e2e:all`.
## Coverage