[{"data":1,"prerenderedAt":1326},["ShallowReactive",2],{"navigation_docs":3,"-manifest-write-a-converter":121,"-manifest-write-a-converter-surround":1321},[4,41,51,56,104,116],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":40},"Learn","i-lucide-book-open","\u002Flearn","1.learn",[10,15,20,25,30,35],{"title":11,"path":12,"stem":13,"icon":14},"What visual regression testing is","\u002Flearn\u002Fwhat-is-visual-regression-testing","1.learn\u002F1.what-is-visual-regression-testing","i-lucide-eye",{"title":16,"path":17,"stem":18,"icon":19},"How image diffing works","\u002Flearn\u002Fhow-image-diffing-works","1.learn\u002F2.how-image-diffing-works","i-lucide-diff",{"title":21,"path":22,"stem":23,"icon":24},"Why screenshots flake","\u002Flearn\u002Fwhy-screenshots-flake","1.learn\u002F3.why-screenshots-flake","i-lucide-shuffle",{"title":26,"path":27,"stem":28,"icon":29},"Baselines and approval","\u002Flearn\u002Fbaselines-and-approval","1.learn\u002F4.baselines-and-approval","i-lucide-check-check",{"title":31,"path":32,"stem":33,"icon":34},"Running in CI","\u002Flearn\u002Frunning-in-ci","1.learn\u002F5.running-in-ci","i-lucide-workflow",{"title":36,"path":37,"stem":38,"icon":39},"FAQ","\u002Flearn\u002Ffaq","1.learn\u002F7.faq","i-lucide-circle-help",false,{"title":42,"icon":43,"path":44,"stem":45,"children":46,"page":40},"Deep dives","i-lucide-telescope","\u002Fdeep-dives","3.deep-dives",[47],{"title":48,"path":49,"stem":50,"icon":43},"Types of visual diffing","\u002Fdeep-dives\u002Fdiff-engines","3.deep-dives\u002F1.diff-engines",{"title":52,"path":53,"stem":54,"icon":55},"Compare the tools","\u002Fcompare","4.compare","i-lucide-scale",{"title":57,"path":58,"stem":59,"children":60,"icon":63},"Manifest","\u002Fmanifest","5.manifest\u002F1.index",[61,64,69,74,79,84,89,94,99],{"title":62,"path":58,"stem":59,"icon":63},"The run manifest","i-lucide-file-json",{"title":65,"path":66,"stem":67,"icon":68},"Write your own converter","\u002Fmanifest\u002Fwrite-a-converter","5.manifest\u002F10.write-a-converter","i-lucide-wrench",{"title":70,"path":71,"stem":72,"icon":73},"The format","\u002Fmanifest\u002Fformat","5.manifest\u002F2.format","i-lucide-file-code",{"title":75,"path":76,"stem":77,"icon":78},"Reading manifests","\u002Fmanifest\u002Freading","5.manifest\u002F3.reading","i-lucide-book-open-check",{"title":80,"path":81,"stem":82,"icon":83},"Merging the manifests of a run","\u002Fmanifest\u002Fmerging","5.manifest\u002F4.merging","i-lucide-merge",{"title":85,"path":86,"stem":87,"icon":88},"Writing manifests","\u002Fmanifest\u002Fwriting","5.manifest\u002F5.writing","i-lucide-pencil-line",{"title":90,"path":91,"stem":92,"icon":93},"Converting to and from other formats","\u002Fmanifest\u002Fconverting","5.manifest\u002F6.converting","i-lucide-arrow-left-right",{"title":95,"path":96,"stem":97,"icon":98},"Reference","\u002Fmanifest\u002Freference","5.manifest\u002F7.reference","i-lucide-list",{"title":100,"path":101,"stem":102,"icon":103},"Schema reference","\u002Fmanifest\u002Fschema","5.manifest\u002F8.schema","i-lucide-braces",{"title":105,"path":106,"stem":107,"children":108,"icon":14},"Viewer","\u002Fviewer","6.viewer\u002F1.index",[109,111],{"title":110,"path":106,"stem":107,"icon":14},"In-browser Viewer",{"title":112,"path":113,"stem":114,"icon":115},"Command line","\u002Fviewer\u002Fcli","6.viewer\u002F2.cli","i-lucide-terminal",{"title":117,"path":118,"stem":119,"icon":120},"Which diff algorithm is best for you?","\u002Fdiff-algorithms","8.diff-algorithms","i-lucide-git-compare",{"id":122,"title":65,"body":123,"description":1314,"extension":1315,"links":1316,"meta":1317,"navigation":1318,"path":66,"seo":1319,"stem":67,"__hash__":1320},"docs\u002F5.manifest\u002F10.write-a-converter.md",{"type":124,"value":125,"toc":1307},"minimark",[126,135,140,143,228,232,239,666,677,1070,1093,1097,1100,1144,1148,1202,1205,1224,1227,1231,1241,1295,1303],[127,128,129,130,134],"p",{},"A converter reads what a tool leaves behind (image folders, a JSON report, or both) and returns a ",[131,132,133],"a",{"href":71},"manifest",". Start with a script for your own project. If other people use the tool, turn it into a converter in the package afterward.",[136,137,139],"h2",{"id":138},"_1-find-out-what-the-tool-writes","1. Find out what the tool writes",[127,141,142],{},"Run the tool with one passing comparison, one failing and one without a baseline, and look at the files. You need answers to these:",[144,145,146,159],"table",{},[147,148,149],"thead",{},[150,151,152,156],"tr",{},[153,154,155],"th",{},"Question",[153,157,158],{},"Why it matters",[160,161,162,171,184,200,212],"tbody",{},[150,163,164,168],{},[165,166,167],"td",{},"Where do the baseline, the actual and the diff image go?",[165,169,170],{},"They are the three paths of every entry.",[150,172,173,176],{},[165,174,175],{},"Does a passing comparison leave an actual image?",[165,177,178,179,183],{},"Some tools clean up when it passes, some never write one. A ",[180,181,182],"code",{},"passed"," entry lists no actual and no diff image.",[150,185,186,189],{},[165,187,188],{},"What does a missing baseline look like, and what does the tool do about it?",[165,190,191,192,195,196,199],{},"Without a baseline the status is ",[180,193,194],{},"missing-baseline"," (the tool was told not to create one) or ",[180,197,198],{},"created"," (it wrote one).",[150,201,202,205],{},[165,203,204],{},"Is there a report, and does it carry the diff ratio?",[165,206,207,208,211],{},"Without one, the status comes from which files exist and ",[180,209,210],{},"diffRatio"," stays unknown.",[150,213,214,217],{},[165,215,216],{},"What were the limits?",[165,218,219,220,223,224,227],{},"The files rarely say. The ratio you accept (",[180,221,222],{},"maxDiffPixelRatio",", ",[180,225,226],{},"failureThreshold",", ...) and the per-pixel color tolerance come from your configuration, so take them as options.",[136,229,231],{"id":230},"_2-write-a-script","2. Write a script",[127,233,234,235,238],{},"For a tool that leaves a baseline and, on failure, an actual and a diff image, ",[180,236,237],{},"fromImageTriples"," needs only the baselines. It infers the status from which files exist and reads the image sizes from the PNG headers:",[240,241,246],"pre",{"className":242,"code":243,"language":244,"meta":245,"style":245},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import fs from 'fs';\nimport {\n  fromImageTriples,\n  writeManifestFile,\n} from 'visual-regression-manifest';\n\nconst baselines = fs\n  .readdirSync('shots')\n  .filter((file) => file.endsWith('.png') && !\u002F\\.(actual|diff)\\.png$\u002F.test(file));\n\nconst manifest = fromImageTriples({\n  projectRoot: process.cwd(),\n  runner: { name: 'my-tool', version: '1.4.0' }, \u002F\u002F the tool you convert from\n  triples: baselines.map((file) => ({\n    baseline: `shots\u002F${file}`,\n    \u002F\u002F actual and diff default to `.actual` and `.diff` siblings; pass them when yours are elsewhere\n    maxDiffRatio: 0.01, \u002F\u002F your threshold, when the tool takes one\n  })),\n});\nwriteManifestFile('visual-regression-manifest.my-tool.json', manifest);\n","ts","",[180,247,248,278,286,295,303,321,328,344,367,455,460,478,501,546,577,601,607,624,635,644],{"__ignoreMap":245},[249,250,253,257,261,264,268,272,275],"span",{"class":251,"line":252},"line",1,[249,254,256],{"class":255},"s7zQu","import",[249,258,260],{"class":259},"sTEyZ"," fs ",[249,262,263],{"class":255},"from",[249,265,267],{"class":266},"sMK4o"," '",[249,269,271],{"class":270},"sfazB","fs",[249,273,274],{"class":266},"'",[249,276,277],{"class":266},";\n",[249,279,281,283],{"class":251,"line":280},2,[249,282,256],{"class":255},[249,284,285],{"class":266}," {\n",[249,287,289,292],{"class":251,"line":288},3,[249,290,291],{"class":259},"  fromImageTriples",[249,293,294],{"class":266},",\n",[249,296,298,301],{"class":251,"line":297},4,[249,299,300],{"class":259},"  writeManifestFile",[249,302,294],{"class":266},[249,304,306,309,312,314,317,319],{"class":251,"line":305},5,[249,307,308],{"class":266},"}",[249,310,311],{"class":255}," from",[249,313,267],{"class":266},[249,315,316],{"class":270},"visual-regression-manifest",[249,318,274],{"class":266},[249,320,277],{"class":266},[249,322,324],{"class":251,"line":323},6,[249,325,327],{"emptyLinePlaceholder":326},true,"\n",[249,329,331,335,338,341],{"class":251,"line":330},7,[249,332,334],{"class":333},"spNyl","const",[249,336,337],{"class":259}," baselines ",[249,339,340],{"class":266},"=",[249,342,343],{"class":259}," fs\n",[249,345,347,350,354,357,359,362,364],{"class":251,"line":346},8,[249,348,349],{"class":266},"  .",[249,351,353],{"class":352},"s2Zo4","readdirSync",[249,355,356],{"class":259},"(",[249,358,274],{"class":266},[249,360,361],{"class":270},"shots",[249,363,274],{"class":266},[249,365,366],{"class":259},")\n",[249,368,370,372,375,377,379,383,386,389,392,395,398,400,402,405,407,410,413,416,419,422,424,427,430,433,435,437,440,443,445,447,450,453],{"class":251,"line":369},9,[249,371,349],{"class":266},[249,373,374],{"class":352},"filter",[249,376,356],{"class":259},[249,378,356],{"class":266},[249,380,382],{"class":381},"sHdIc","file",[249,384,385],{"class":266},")",[249,387,388],{"class":333}," =>",[249,390,391],{"class":259}," file",[249,393,394],{"class":266},".",[249,396,397],{"class":352},"endsWith",[249,399,356],{"class":259},[249,401,274],{"class":266},[249,403,404],{"class":270},".png",[249,406,274],{"class":266},[249,408,409],{"class":259},") ",[249,411,412],{"class":266},"&&",[249,414,415],{"class":266}," !",[249,417,418],{"class":266},"\u002F",[249,420,421],{"class":259},"\\.",[249,423,356],{"class":266},[249,425,426],{"class":270},"actual",[249,428,429],{"class":266},"|",[249,431,432],{"class":270},"diff",[249,434,385],{"class":266},[249,436,421],{"class":259},[249,438,439],{"class":270},"png",[249,441,442],{"class":255},"$",[249,444,418],{"class":266},[249,446,394],{"class":266},[249,448,449],{"class":352},"test",[249,451,452],{"class":259},"(file))",[249,454,277],{"class":266},[249,456,458],{"class":251,"line":457},10,[249,459,327],{"emptyLinePlaceholder":326},[249,461,463,465,468,470,473,475],{"class":251,"line":462},11,[249,464,334],{"class":333},[249,466,467],{"class":259}," manifest ",[249,469,340],{"class":266},[249,471,472],{"class":352}," fromImageTriples",[249,474,356],{"class":259},[249,476,477],{"class":266},"{\n",[249,479,481,485,488,491,493,496,499],{"class":251,"line":480},12,[249,482,484],{"class":483},"swJcz","  projectRoot",[249,486,487],{"class":266},":",[249,489,490],{"class":259}," process",[249,492,394],{"class":266},[249,494,495],{"class":352},"cwd",[249,497,498],{"class":259},"()",[249,500,294],{"class":266},[249,502,504,507,509,512,515,517,519,522,524,527,530,532,534,537,539,542],{"class":251,"line":503},13,[249,505,506],{"class":483},"  runner",[249,508,487],{"class":266},[249,510,511],{"class":266}," {",[249,513,514],{"class":483}," name",[249,516,487],{"class":266},[249,518,267],{"class":266},[249,520,521],{"class":270},"my-tool",[249,523,274],{"class":266},[249,525,526],{"class":266},",",[249,528,529],{"class":483}," version",[249,531,487],{"class":266},[249,533,267],{"class":266},[249,535,536],{"class":270},"1.4.0",[249,538,274],{"class":266},[249,540,541],{"class":266}," },",[249,543,545],{"class":544},"sHwdD"," \u002F\u002F the tool you convert from\n",[249,547,549,552,554,557,559,562,564,566,568,570,572,575],{"class":251,"line":548},14,[249,550,551],{"class":483},"  triples",[249,553,487],{"class":266},[249,555,556],{"class":259}," baselines",[249,558,394],{"class":266},[249,560,561],{"class":352},"map",[249,563,356],{"class":259},[249,565,356],{"class":266},[249,567,382],{"class":381},[249,569,385],{"class":266},[249,571,388],{"class":333},[249,573,574],{"class":259}," (",[249,576,477],{"class":266},[249,578,580,583,585,588,591,594,596,599],{"class":251,"line":579},15,[249,581,582],{"class":483},"    baseline",[249,584,487],{"class":266},[249,586,587],{"class":266}," `",[249,589,590],{"class":270},"shots\u002F",[249,592,593],{"class":266},"${",[249,595,382],{"class":259},[249,597,598],{"class":266},"}`",[249,600,294],{"class":266},[249,602,604],{"class":251,"line":603},16,[249,605,606],{"class":544},"    \u002F\u002F actual and diff default to `.actual` and `.diff` siblings; pass them when yours are elsewhere\n",[249,608,610,613,615,619,621],{"class":251,"line":609},17,[249,611,612],{"class":483},"    maxDiffRatio",[249,614,487],{"class":266},[249,616,618],{"class":617},"sbssI"," 0.01",[249,620,526],{"class":266},[249,622,623],{"class":544}," \u002F\u002F your threshold, when the tool takes one\n",[249,625,627,630,633],{"class":251,"line":626},18,[249,628,629],{"class":266},"  }",[249,631,632],{"class":259},"))",[249,634,294],{"class":266},[249,636,638,640,642],{"class":251,"line":637},19,[249,639,308],{"class":266},[249,641,385],{"class":259},[249,643,277],{"class":266},[249,645,647,650,652,654,657,659,661,664],{"class":251,"line":646},20,[249,648,649],{"class":352},"writeManifestFile",[249,651,356],{"class":259},[249,653,274],{"class":266},[249,655,656],{"class":270},"visual-regression-manifest.my-tool.json",[249,658,274],{"class":266},[249,660,526],{"class":266},[249,662,663],{"class":259}," manifest)",[249,665,277],{"class":266},[127,667,668,669,672,673,676],{},"When the tool has a report, or the layout needs more than the defaults, use ",[180,670,671],{},"ManifestBuilder"," directly, one ",[180,674,675],{},"record"," call per comparison:",[240,678,680],{"className":242,"code":679,"language":244,"meta":245,"style":245},"import fs from 'fs';\nimport { ManifestBuilder, writeManifestFile } from 'visual-regression-manifest';\n\nconst report = JSON.parse(fs.readFileSync('my-tool-report.json', 'utf8'));\nconst builder = new ManifestBuilder({\n  projectRoot: process.cwd(),\n  runner: { name: 'my-tool', version: report.version },\n});\nfor (const result of report.results) {\n  builder.record({\n    baselinePath: result.expected,\n    actualPath: result.received,\n    diffPath: result.diff ?? null, \u002F\u002F null when the tool writes no diff image\n    name: result.name,\n    testFile: result.file,\n    status: result.ok ? 'passed' : 'failed',\n    diffRatio: result.mismatch, \u002F\u002F a 0..1 share of the pixels, not a percentage\n  });\n}\nwriteManifestFile('visual-regression-manifest.my-tool.json', builder.toJSON());\n",[180,681,682,698,725,729,776,794,810,845,853,877,890,907,923,945,961,976,1011,1030,1038,1043],{"__ignoreMap":245},[249,683,684,686,688,690,692,694,696],{"class":251,"line":252},[249,685,256],{"class":255},[249,687,260],{"class":259},[249,689,263],{"class":255},[249,691,267],{"class":266},[249,693,271],{"class":270},[249,695,274],{"class":266},[249,697,277],{"class":266},[249,699,700,702,704,707,709,712,715,717,719,721,723],{"class":251,"line":280},[249,701,256],{"class":255},[249,703,511],{"class":266},[249,705,706],{"class":259}," ManifestBuilder",[249,708,526],{"class":266},[249,710,711],{"class":259}," writeManifestFile",[249,713,714],{"class":266}," }",[249,716,311],{"class":255},[249,718,267],{"class":266},[249,720,316],{"class":270},[249,722,274],{"class":266},[249,724,277],{"class":266},[249,726,727],{"class":251,"line":288},[249,728,327],{"emptyLinePlaceholder":326},[249,730,731,733,736,738,741,743,746,749,751,754,756,758,761,763,765,767,770,772,774],{"class":251,"line":297},[249,732,334],{"class":333},[249,734,735],{"class":259}," report ",[249,737,340],{"class":266},[249,739,740],{"class":259}," JSON",[249,742,394],{"class":266},[249,744,745],{"class":352},"parse",[249,747,748],{"class":259},"(fs",[249,750,394],{"class":266},[249,752,753],{"class":352},"readFileSync",[249,755,356],{"class":259},[249,757,274],{"class":266},[249,759,760],{"class":270},"my-tool-report.json",[249,762,274],{"class":266},[249,764,526],{"class":266},[249,766,267],{"class":266},[249,768,769],{"class":270},"utf8",[249,771,274],{"class":266},[249,773,632],{"class":259},[249,775,277],{"class":266},[249,777,778,780,783,785,788,790,792],{"class":251,"line":305},[249,779,334],{"class":333},[249,781,782],{"class":259}," builder ",[249,784,340],{"class":266},[249,786,787],{"class":266}," new",[249,789,706],{"class":352},[249,791,356],{"class":259},[249,793,477],{"class":266},[249,795,796,798,800,802,804,806,808],{"class":251,"line":323},[249,797,484],{"class":483},[249,799,487],{"class":266},[249,801,490],{"class":259},[249,803,394],{"class":266},[249,805,495],{"class":352},[249,807,498],{"class":259},[249,809,294],{"class":266},[249,811,812,814,816,818,820,822,824,826,828,830,832,834,837,839,842],{"class":251,"line":330},[249,813,506],{"class":483},[249,815,487],{"class":266},[249,817,511],{"class":266},[249,819,514],{"class":483},[249,821,487],{"class":266},[249,823,267],{"class":266},[249,825,521],{"class":270},[249,827,274],{"class":266},[249,829,526],{"class":266},[249,831,529],{"class":483},[249,833,487],{"class":266},[249,835,836],{"class":259}," report",[249,838,394],{"class":266},[249,840,841],{"class":259},"version ",[249,843,844],{"class":266},"},\n",[249,846,847,849,851],{"class":251,"line":346},[249,848,308],{"class":266},[249,850,385],{"class":259},[249,852,277],{"class":266},[249,854,855,858,860,862,865,868,870,872,875],{"class":251,"line":369},[249,856,857],{"class":255},"for",[249,859,574],{"class":259},[249,861,334],{"class":333},[249,863,864],{"class":259}," result ",[249,866,867],{"class":266},"of",[249,869,836],{"class":259},[249,871,394],{"class":266},[249,873,874],{"class":259},"results) ",[249,876,477],{"class":266},[249,878,879,882,884,886,888],{"class":251,"line":457},[249,880,881],{"class":259},"  builder",[249,883,394],{"class":266},[249,885,675],{"class":352},[249,887,356],{"class":483},[249,889,477],{"class":266},[249,891,892,895,897,900,902,905],{"class":251,"line":462},[249,893,894],{"class":483},"    baselinePath",[249,896,487],{"class":266},[249,898,899],{"class":259}," result",[249,901,394],{"class":266},[249,903,904],{"class":259},"expected",[249,906,294],{"class":266},[249,908,909,912,914,916,918,921],{"class":251,"line":480},[249,910,911],{"class":483},"    actualPath",[249,913,487],{"class":266},[249,915,899],{"class":259},[249,917,394],{"class":266},[249,919,920],{"class":259},"received",[249,922,294],{"class":266},[249,924,925,928,930,932,934,936,939,942],{"class":251,"line":503},[249,926,927],{"class":483},"    diffPath",[249,929,487],{"class":266},[249,931,899],{"class":259},[249,933,394],{"class":266},[249,935,432],{"class":259},[249,937,938],{"class":266}," ??",[249,940,941],{"class":266}," null,",[249,943,944],{"class":544}," \u002F\u002F null when the tool writes no diff image\n",[249,946,947,950,952,954,956,959],{"class":251,"line":548},[249,948,949],{"class":483},"    name",[249,951,487],{"class":266},[249,953,899],{"class":259},[249,955,394],{"class":266},[249,957,958],{"class":259},"name",[249,960,294],{"class":266},[249,962,963,966,968,970,972,974],{"class":251,"line":579},[249,964,965],{"class":483},"    testFile",[249,967,487],{"class":266},[249,969,899],{"class":259},[249,971,394],{"class":266},[249,973,382],{"class":259},[249,975,294],{"class":266},[249,977,978,981,983,985,987,990,993,995,997,999,1002,1004,1007,1009],{"class":251,"line":603},[249,979,980],{"class":483},"    status",[249,982,487],{"class":266},[249,984,899],{"class":259},[249,986,394],{"class":266},[249,988,989],{"class":259},"ok",[249,991,992],{"class":266}," ?",[249,994,267],{"class":266},[249,996,182],{"class":270},[249,998,274],{"class":266},[249,1000,1001],{"class":266}," :",[249,1003,267],{"class":266},[249,1005,1006],{"class":270},"failed",[249,1008,274],{"class":266},[249,1010,294],{"class":266},[249,1012,1013,1016,1018,1020,1022,1025,1027],{"class":251,"line":609},[249,1014,1015],{"class":483},"    diffRatio",[249,1017,487],{"class":266},[249,1019,899],{"class":259},[249,1021,394],{"class":266},[249,1023,1024],{"class":259},"mismatch",[249,1026,526],{"class":266},[249,1028,1029],{"class":544}," \u002F\u002F a 0..1 share of the pixels, not a percentage\n",[249,1031,1032,1034,1036],{"class":251,"line":626},[249,1033,629],{"class":266},[249,1035,385],{"class":483},[249,1037,277],{"class":266},[249,1039,1040],{"class":251,"line":637},[249,1041,1042],{"class":266},"}\n",[249,1044,1045,1047,1049,1051,1053,1055,1057,1060,1062,1065,1068],{"class":251,"line":646},[249,1046,649],{"class":352},[249,1048,356],{"class":259},[249,1050,274],{"class":266},[249,1052,656],{"class":270},[249,1054,274],{"class":266},[249,1056,526],{"class":266},[249,1058,1059],{"class":259}," builder",[249,1061,394],{"class":266},[249,1063,1064],{"class":352},"toJSON",[249,1066,1067],{"class":259},"())",[249,1069,277],{"class":266},[127,1071,1072,1073,1076,1077,1080,1081,1084,1085,1088,1089,1092],{},"The builder makes every path relative to ",[180,1074,1075],{},"projectRoot",", sets a path to ",[180,1078,1079],{},"null"," when the file does not exist, hashes the images that do, and keeps ",[180,1082,1083],{},"summary"," up to date. ",[180,1086,1087],{},"tool"," defaults to this library and ",[180,1090,1091],{},"runner"," is the tool you convert from.",[136,1094,1096],{"id":1095},"_3-get-the-statuses-right","3. Get the statuses right",[127,1098,1099],{},"Most of a converter's value is in the status, so claim only what the files show:",[1101,1102,1103,1121,1128,1133],"ul",{},[1104,1105,1106,1107,1109,1110,1112,1113,1116,1117,1120],"li",{},"A baseline the run just wrote is not a failure. If the tool creates a missing baseline, the entry is ",[180,1108,198],{}," and no human is needed. If it fails on a missing baseline (a CI mode), it is ",[180,1111,194],{},". When the files look the same in both cases, take a ",[180,1114,1115],{},"update"," or ",[180,1118,1119],{},"ci"," option from the user rather than guessing.",[1104,1122,1123,1124,1127],{},"A baseline with no actual image was not compared. Leave it out and say so under ",[180,1125,1126],{},"extra",", as the reg-cli, Lost Pixel and Loki converters do.",[1104,1129,1130,1131,394],{},"The manifest stores ratios as a share from 0 to 1. If a tool reports 2.3, store 0.023. If it reports a square root or another scale, convert it back and keep the tool's number under ",[180,1132,1126],{},[1104,1134,1135,1136,1139,1140,1143],{},"Limits are optional. Leave ",[180,1137,1138],{},"maxDiffRatio"," out when you do not know it. A missing limit means \"unknown\", not \"zero\". A per-pixel color tolerance needs a ",[180,1141,1142],{},"colorMetric",", since a number on another scale is not comparable.",[136,1145,1147],{"id":1146},"_4-check-the-result","4. Check the result",[240,1149,1151],{"className":242,"code":1150,"language":244,"meta":245,"style":245},"import { validateManifest } from 'visual-regression-manifest';\n\nconsole.log(validateManifest(manifest)); \u002F\u002F [] when it is valid\n",[180,1152,1153,1174,1178],{"__ignoreMap":245},[249,1154,1155,1157,1159,1162,1164,1166,1168,1170,1172],{"class":251,"line":252},[249,1156,256],{"class":255},[249,1158,511],{"class":266},[249,1160,1161],{"class":259}," validateManifest",[249,1163,714],{"class":266},[249,1165,311],{"class":255},[249,1167,267],{"class":266},[249,1169,316],{"class":270},[249,1171,274],{"class":266},[249,1173,277],{"class":266},[249,1175,1176],{"class":251,"line":280},[249,1177,327],{"emptyLinePlaceholder":326},[249,1179,1180,1183,1185,1188,1190,1193,1196,1199],{"class":251,"line":288},[249,1181,1182],{"class":259},"console",[249,1184,394],{"class":266},[249,1186,1187],{"class":352},"log",[249,1189,356],{"class":259},[249,1191,1192],{"class":352},"validateManifest",[249,1194,1195],{"class":259},"(manifest))",[249,1197,1198],{"class":266},";",[249,1200,1201],{"class":544}," \u002F\u002F [] when it is valid\n",[127,1203,1204],{},"Then look at it. Put the manifest next to the images and open the folder with the viewer:",[240,1206,1210],{"className":1207,"code":1208,"language":1209,"meta":245,"style":245},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npx visual-regression-viewer .\n","bash",[180,1211,1212],{"__ignoreMap":245},[249,1213,1214,1218,1221],{"class":251,"line":252},[249,1215,1217],{"class":1216},"sBMFI","npx",[249,1219,1220],{"class":270}," visual-regression-viewer",[249,1222,1223],{"class":270}," .\n",[127,1225,1226],{},"Every failed entry should show its three images and the slider. A baseline that shows as missing when the file exists points at a wrong path.",[136,1228,1230],{"id":1229},"_5-contribute-it","5. Contribute it",[127,1232,1233,1234,1240],{},"When the tool is used by others, a converter in the package spares each of them the script. The ",[131,1235,1239],{"href":1236,"rel":1237},"https:\u002F\u002Fgithub.com\u002Fvisual-regression\u002Fvisual-regression",[1238],"nofollow","repository"," asks for:",[1242,1243,1244,1259,1270,1273,1288],"ol",{},[1104,1245,1246,1247,1250,1251,1254,1255,1258],{},"The converter: one file in ",[180,1248,1249],{},"packages\u002Fvisual-regression-manifest\u002Fsrc\u002Fconvert\u002F",", exported from ",[180,1252,1253],{},"src\u002Findex.ts",". ",[180,1256,1257],{},"jest-image-snapshot.ts"," is the most complete one to copy.",[1104,1260,1261,1262,1265,1266,1269],{},"An example project in ",[180,1263,1264],{},"examples\u002Fconverters\u002F\u003Ctool>\u002F"," that runs the real tool in a browser: records baselines, makes one comparison fail, removes one baseline, converts and checks the manifest against the files on disk. It captures what the tool wrote into fixtures for the unit test, so the converter is tested against real output. ",[180,1267,1268],{},"examples\u002Fconverters\u002FREADME.md"," explains the harness.",[1104,1271,1272],{},"A unit test that runs the converter on those fixtures.",[1104,1274,1275,1276,1279,1280,1283,1284,1287],{},"A command line entry in ",[180,1277,1278],{},"src\u002Fcli\u002Fconvert.ts",", so ",[180,1281,1282],{},"npx visual-regression-manifest convert \u003Ctool>"," works, and a section in the package README's converting chapter, which this site's ",[131,1285,1286],{"href":91},"converting page"," is generated from.",[1104,1289,1290,1291,1294],{},"A comparison entry for the tool in ",[180,1292,1293],{},"apps\u002Fsite\u002Fdata\u002Ftools\u002F\u003Ctool>.yml",", with a source URL for every claim.",[127,1296,1297,1302],{},[131,1298,1301],{"href":1299,"rel":1300},"https:\u002F\u002Fgithub.com\u002Fvisual-regression\u002Fvisual-regression\u002Fblob\u002Fmain\u002FCONTRIBUTING.md",[1238],"CONTRIBUTING"," has the pull request conventions. If you would rather not write it yourself, open an issue with the converter request form and a small sample of the tool's real output.",[1304,1305,1306],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":245,"searchDepth":280,"depth":280,"links":1308},[1309,1310,1311,1312,1313],{"id":138,"depth":280,"text":139},{"id":230,"depth":280,"text":231},{"id":1095,"depth":280,"text":1096},{"id":1146,"depth":280,"text":1147},{"id":1229,"depth":280,"text":1230},"Turn the output of a visual regression tool that writes no manifest into one, from a short script to a converter in the package, and check the result against the files on disk.","md",null,{},{"icon":68},{"title":65,"description":1314},"jwk0zxqpWn97jlHU-lc3u83fIK7veocg7N2x8E9P-qo",[1322,1324],{"title":62,"path":58,"stem":59,"description":1323,"icon":63,"children":-1},"The standard we propose. One JSON file per test run that lists every screenshot comparison. Built upon CTRF, compatible with several tools and read by PR bots and review apps.",{"title":70,"path":71,"stem":72,"description":1325,"icon":73,"children":-1},"Available as JSON Schema at https:\u002F\u002Fvisual-regression.dev\u002Fschema\u002Fv1.json or schema.json (in the repository under src\u002F) and importable as visual-regression-manifest\u002Fschema.json or the manifestSchema export.",1795388678439]