test(e2e): stop a host run from writing unusable visual baselines

Nothing enforced the container requirement — only a comment mentioned it. Running
the visual project on a developer machine writes `*-visual-darwin.png` next to the
linux baselines: new files CI never reads, so it stays red while the repo collects
junk and nothing says why. Fail up front with the command to use instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-21 15:55:53 +07:00
co-authored by Claude Fable 5
parent 04e923c6da
commit f2ae87bc8f
+8
View File
@@ -10,6 +10,14 @@ const isCI = Boolean(process.env.CI);
// that never match CI pixels.
const isVisual = process.env.E2E_VISUAL === '1';
// Baselines are linux-suffixed, so a host run writes `*-visual-darwin.png` beside
// them: new files CI never reads, leaving it red with nothing to explain why.
if (isVisual && process.platform !== 'linux') {
throw new Error(
`visual snapshots must run in the pinned container — use e2e/tools/run-visual.sh (got platform "${process.platform}")`,
);
}
// `vite preview` listens on VITE_PORT + 100 and reuses the dev proxy config.
const PREVIEW_PORT = 8100;