51 lines
1.9 KiB
TypeScript
51 lines
1.9 KiB
TypeScript
/**
|
|
* Lost-Pixel visual-regression config (Phase 08 #62).
|
|
*
|
|
* Lost-Pixel walks the built static Storybook, screenshots every story,
|
|
* and diffs each shot against a committed baseline under
|
|
* `.lostpixel/baseline/`. A pixel-diff above `threshold` fails CI and
|
|
* uploads the diff image as an artifact.
|
|
*
|
|
* NOT enabled in CI yet — the `visual-regression` job in
|
|
* `.github/workflows/storybook.yml` / `.gitea/workflows/storybook.yml`
|
|
* is gated on the baseline directory being populated. An operator runs
|
|
* `pnpm --filter @toolctrl/storybook visual-regression:update` once
|
|
* against a known-good build and commits the generated baseline PNGs;
|
|
* from then on the job blocks PRs on unintended visual drift.
|
|
*
|
|
* See docs/architecture/storybook.md § Visual-regression for the
|
|
* bootstrap runbook.
|
|
*/
|
|
import type { CustomProjectConfig } from "lost-pixel";
|
|
|
|
export const config: CustomProjectConfig = {
|
|
// Point at the static build produced by `build-storybook`. Lost-Pixel
|
|
// serves it itself, so this is a path, not a URL.
|
|
storybookShots: {
|
|
storybookUrl: "./storybook-static",
|
|
},
|
|
|
|
// Baseline PNGs live in-repo so a diff is reviewable in the PR.
|
|
imagePathBaseline: "./.lostpixel/baseline",
|
|
imagePathCurrent: "./.lostpixel/current",
|
|
imagePathDifference: "./.lostpixel/difference",
|
|
|
|
// 0.1 % pixel-diff tolerance — absorbs sub-pixel font AA jitter
|
|
// between CI runners without masking real layout regressions.
|
|
threshold: 0.001,
|
|
|
|
// Lower than the default so CI doesn't stall on a cold cache; the
|
|
// story set is small (~21 stories).
|
|
waitBeforeScreenshot: 500,
|
|
|
|
// Generate the comparison even when there is no baseline yet so the
|
|
// first operator run produces a full baseline set.
|
|
generateOnly: false,
|
|
|
|
// CI integration is opt-in; left unset so a local run never tries to
|
|
// post to an external service.
|
|
// apiKey / setPendingStatusCheck deliberately omitted.
|
|
};
|
|
|
|
export default config;
|