vitals-pulse

Pulse · web performance

vitals-pulse

Fail CI when Core Web Vitals get worse: LCP, CLS and an INP proxy, gated on thresholds and on regressions against your baseline.

npm i -D @mrlouiswright/vitals-pulse

Published to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).

What it checks

  • MetricsLCP, CLS, TBT (Total Blocking Time, the lab proxy for INP), INP (from PSI field data or web-vitals), FCP, TTFB and Speed Index, with the standard good/poor thresholds (LCP 2.5 s / 4 s, CLS 0.1 / 0.25, TBT 200 / 600 ms, INP 200 / 500 ms)…
  • Stable numbersmultiple runs per URL are combined with the median, like Lighthouse CI; large run-to-run spread is noted.
  • Regressions--snapshot saves medians; --baseline fails when a metric gets more than --max-regression percent worse (default 10%) and by more than a meaningful absolute amount (100 ms LCP, 0.02 CLS, 50 ms TBT).
  • InputsLighthouse/LHCI/PSI JSON, web-vitals JSON or JSON lines (p75 per URL), any mix of files and directories. Failed Lighthouse runs (runtimeError) are reported, not silently skipped.
  • Optional runner--url runs an installed lighthouse CLI (desktop or mobile preset) several times per URL.

Quick usage

CLI

npx vitals-pulse .lighthouseci
npx vitals-pulse reports/ --lcp 2000 --min-score 0.9
npx vitals-pulse reports/ --snapshot vitals-base.json   # on main
npx vitals-pulse reports/ --baseline vitals-base.json --max-regression 5
npx vitals-pulse --url https://example.com/ --runs 5 --preset mobile

API

import { loadRuns, summarise, evaluate } from "vitals-pulse";
const { runs } = loadRuns([".lighthouseci"]);
const findings = evaluate(summarise(runs), { thresholds: { lcp: 2000 } });

Every option is documented in the vitals-pulse docs.

CI / GitHub Action

permissions:
  contents: read
  security-events: write   # only needed for the SARIF upload
jobs:
  vitals-pulse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
        with: { persist-credentials: false }
      - uses: MrLouisWright/vitals-pulse@v1
        with:
          path: .lighthouseci
          fail-on: high
          sarif: vitals-pulse.sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with: { sarif_file: vitals-pulse.sarif }