Manifest
Reading manifests
import {
import {
readManifestFiles,
readManifestFile,
parseManifest,
ManifestParseError,
} from 'visual-regression-manifest';
// every manifest below a directory (an unpacked CI artifact), sorted by path
const found = readManifestFiles('artifacts/test');
// -> [{ file: '.../visual-regression-manifest.e2e.json', manifest: {...} }, ...]
// one file
const manifest = readManifestFile(
'cypress/screenshots/visual-regression-manifest.e2e.json',
);
// already-parsed JSON from anywhere (a zip entry, an HTTP body)
try {
const manifest = parseManifest(
json,
'test.zip:visual-regression-manifest.e2e.json',
);
} catch (error) {
if (error instanceof ManifestParseError)
console.error(error.message, error.issues);
}
parseManifest validates against the shipped schema with a small built-in interpreter (cross-checked against Ajv in the test suite); validateManifest returns the issues without throwing and isManifest is the type guard. Unknown keys pass through untouched.
The format
The normative description is the JSON Schema (draft 2020-12) at https://visual-regression.dev/schema/v1.json, shipped as schema.json (in the package, and in the repository under src/) and importable as visual-regression-manifest/schema.json or the manifestSchema export.
Merging the manifests of a run
A run usually produces several manifests.