[{"data":1,"prerenderedAt":1920,"buildId":1921},["ShallowReactive",2],{"docs:\u002Fintegrations\u002Ftesting":3},{"page":4,"section":16,"document":17,"credits":10,"prev":1912,"next":1916},{"id":5,"path":6,"file":7,"title":8,"sourceTitle":8,"description":9,"tagline":9,"eyebrow":10,"credits":10,"keywords":11,"icon":12,"layout":13,"sidebar":14,"toc":14,"kind":10,"group":10,"navigation":14,"order":15},"testing","\u002Fintegrations\u002Ftesting","integrations\u002Ftesting.md","Testing your CLI","Test one readerly command as a terminal, a coding agent, GitHub Actions and --format json with a fake Io, prompts answered, and golden files per reader.",null,[],"i-lucide-flask-conical","article",true,4,"integrations",{"nodes":18,"toc":1905},[19,36,58,66,84,419,425,430,538,545,1048,1066,1072,1075,1611,1621,1628,1664,1670,1694,1711,1717,1728,1885,1896],[20,21,22,23,27,28,31,32,35],"p",{},"A readerly command prints something different for each reader, so one test per reader catches a change that only an agent or only CI would see. You don't need a real terminal or real environment variables: ",[24,25,26],"code",{},"createOut"," takes an ",[24,29,30],{},"Io"," with the environment, the three streams and a clock, and reads nothing else from ",[24,33,34],{},"process",".",[20,37,38,39,46,47,50,51,57],{},"readerly tests itself this way in ",[40,41,43],"a",{"href":42},"https:\u002F\u002Fgithub.com\u002Floadsheet\u002Freaderly\u002Fblob\u002Fmain\u002Ftest\u002Fgolden.test.ts",[24,44,45],{},"test\u002Fgolden.test.ts",". The examples below use the same ",[24,48,49],{},"acme check"," command, from ",[40,52,54],{"href":53},"https:\u002F\u002Fgithub.com\u002Floadsheet\u002Freaderly\u002Fblob\u002Fmain\u002Ftest\u002Fgolden\u002Fcheck.ts",[24,55,56],{},"test\u002Fgolden\u002Fcheck.ts",", and ran against those golden files.",[59,60,65],"h2",{"id":61,"anchor":62},"make-the-command-testable",{"label":63,"icon":64},"Section titled \"Make the command testable\"","#","Make the command testable",[20,67,68,69,72,73,76,77,79,80,83],{},"Give the command a second parameter for ",[24,70,71],{},"io"," and ",[24,74,75],{},"detection",", and spread it into ",[24,78,26],{},". In production you call ",[24,81,82],{},"check(argv)"," and both fall back to the real process:",[85,86,90],"pre",{"language":87,"filename":88,"class":89,"wrap":14},"ts","src\u002Fcheck.ts","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[24,91,93,122,123,122,125,122,143,122,159,122,196,122,214,122,252,122,263,122,273,122,283,122,288,122,296,122,313,122,324,122,331,122,389,122,394,122,400,122,414],{"class":92},"language-ts",[94,95,98,102,106,109,112,115,119],"span",{"class":96,"style":97},"line","display: inline",[94,99,101],{"style":100},"color:#CF222E;--shiki-dark:#FF7B72","import",[94,103,105],{"style":104},"color:#1F2328;--shiki-dark:#E6EDF3"," { createOut, ",[94,107,108],{"style":100},"type",[94,110,111],{"style":104}," OutOptions } ",[94,113,114],{"style":100},"from",[94,116,118],{"style":117},"color:#0A3069;--shiki-dark:#A5D6FF"," \"readerly\"",[94,120,121],{"style":104},";","\n",[94,124],{"class":96,"style":97},[94,126,127,130,133,136,140],{"class":96,"style":97},[94,128,129],{"style":100},"export",[94,131,132],{"style":100}," async",[94,134,135],{"style":100}," function",[94,137,139],{"style":138},"color:#8250DF;--shiki-dark:#D2A8FF"," check",[94,141,142],{"style":104},"(",[94,144,145,149,152,156],{"class":96,"style":97},[94,146,148],{"style":147},"color:#953800;--shiki-dark:#FFA657","  argv",[94,150,151],{"style":100},":",[94,153,155],{"style":154},"color:#0550AE;--shiki-dark:#79C0FF"," string",[94,157,158],{"style":104},"[],",[94,160,161,164,166,169,172,175,178,181,184,187,190,193],{"class":96,"style":97},[94,162,163],{"style":147},"  options",[94,165,151],{"style":100},[94,167,168],{"style":147}," Pick",[94,170,171],{"style":104},"\u003C",[94,173,174],{"style":147},"OutOptions",[94,176,177],{"style":104},", ",[94,179,180],{"style":117},"\"io\"",[94,182,183],{"style":100}," |",[94,185,186],{"style":117}," \"detection\"",[94,188,189],{"style":104},"> ",[94,191,192],{"style":100},"=",[94,194,195],{"style":104}," {},",[94,197,198,201,203,206,208,211],{"class":96,"style":97},[94,199,200],{"style":104},")",[94,202,151],{"style":100},[94,204,205],{"style":147}," Promise",[94,207,171],{"style":104},[94,209,210],{"style":154},"number",[94,212,213],{"style":104},"> {",[94,215,216,219,222,225,228,231,234,236,239,242,245,247,249],{"class":96,"style":97},[94,217,218],{"style":100},"  const",[94,220,221],{"style":154}," out",[94,223,224],{"style":100}," =",[94,226,227],{"style":138}," createOut",[94,229,230],{"style":104},"\u003C{ ",[94,232,233],{"style":147},"files",[94,235,151],{"style":100},[94,237,238],{"style":154}," number",[94,240,241],{"style":104},"; ",[94,243,244],{"style":147},"durationMs",[94,246,151],{"style":100},[94,248,238],{"style":154},[94,250,251],{"style":104}," }>({",[94,253,254,257,260],{"class":96,"style":97},[94,255,256],{"style":104},"    tool: ",[94,258,259],{"style":117},"\"acme\"",[94,261,262],{"style":104},",",[94,264,265,268,271],{"class":96,"style":97},[94,266,267],{"style":104},"    command: ",[94,269,270],{"style":117},"\"check\"",[94,272,262],{"style":104},[94,274,275,278,281],{"class":96,"style":97},[94,276,277],{"style":104},"    version: ",[94,279,280],{"style":117},"\"1.2.0\"",[94,282,262],{"style":104},[94,284,285],{"class":96,"style":97},[94,286,287],{"style":104},"    argv,",[94,289,290,293],{"class":96,"style":97},[94,291,292],{"style":100},"    ...",[94,294,295],{"style":104},"options,",[94,297,298,301,304,307,310],{"class":96,"style":97},[94,299,300],{"style":138},"    summary",[94,302,303],{"style":104},": (",[94,305,306],{"style":147},"result",[94,308,309],{"style":104},") ",[94,311,312],{"style":100},"=>",[94,314,315,318,321],{"class":96,"style":97},[94,316,317],{"style":104},"      result.files ",[94,319,320],{"style":100},"===",[94,322,323],{"style":154}," undefined",[94,325,326,329],{"class":96,"style":97},[94,327,328],{"style":100},"        ?",[94,330,323],{"style":154},[94,332,333,336,339,341,343,345,348,351,353,355,357,360,363,365,368,371,374,377,379,382,384,387],{"class":96,"style":97},[94,334,335],{"style":100},"        :",[94,337,338],{"style":117}," `in ${",[94,340,306],{"style":104},[94,342,35],{"style":117},[94,344,233],{"style":104},[94,346,347],{"style":117},"} files (${",[94,349,350],{"style":117},"((",[94,352,306],{"style":104},[94,354,35],{"style":117},[94,356,244],{"style":104},[94,358,359],{"style":100}," ??",[94,361,362],{"style":154}," 0",[94,364,309],{"style":117},[94,366,367],{"style":100},"\u002F",[94,369,370],{"style":154}," 1000",[94,372,373],{"style":117},").",[94,375,376],{"style":138},"toFixed",[94,378,142],{"style":117},[94,380,381],{"style":154},"1",[94,383,200],{"style":117},[94,385,386],{"style":117},"}s)`",[94,388,262],{"style":104},[94,390,391],{"class":96,"style":97},[94,392,393],{"style":104},"  });",[94,395,396],{"class":96,"style":97},[94,397,399],{"style":398},"color:#6E7781;--shiki-dark:#8B949E","  \u002F\u002F The scan, the confirm and the next line, as in test\u002Fgolden\u002Fcheck.ts.",[94,401,402,405,408,411],{"class":96,"style":97},[94,403,404],{"style":100},"  return",[94,406,407],{"style":104}," out.",[94,409,410],{"style":138},"end",[94,412,413],{"style":104},"();",[94,415,416],{"class":96,"style":97},[94,417,418],{"style":104},"}",[59,420,424],{"id":421,"anchor":422},"a-fake-io",{"label":423,"icon":64},"Section titled \"A fake Io\"","A fake Io",[20,426,427,429],{},[24,428,30],{}," has five fields. Each one decides part of what the command prints:",[431,432,433,446],"table",{},[434,435,436],"thead",{},[437,438,439,443],"tr",{},[440,441,442],"th",{},"Field",[440,444,445],{},"What it controls",[447,448,449,474,495,512,524],"tbody",{},[437,450,451,457],{},[452,453,454],"td",{},[24,455,456],{},"env",[452,458,459,460,463,464,466,467,469,470,473],{},"Detection, color and ",[24,461,462],{},"\u003CTOOL>_FORMAT",". A partial ",[24,465,71],{}," with ",[24,468,456],{}," replaces ",[24,471,472],{},"process.env"," completely, so the test sees only the variables you list.",[437,475,476,481],{},[452,477,478],{},[24,479,480],{},"stdout",[452,482,483,484,487,488,491,492,35],{},"Where the answer goes. ",[24,485,486],{},"isTTY"," decides ",[24,489,490],{},"terminal"," or ",[24,493,494],{},"pipe",[437,496,497,502],{},[452,498,499],{},[24,500,501],{},"stderr",[452,503,504,505,508,509,35],{},"Prompts, progress, annotations and ",[24,506,507],{},"--verbose",". A prompt needs ",[24,510,511],{},"isTTY: true",[437,513,514,519],{},[452,515,516],{},[24,517,518],{},"stdin",[452,520,521,522,35],{},"Where prompt answers come from. A prompt needs ",[24,523,511],{},[437,525,526,531],{},[452,527,528],{},[24,529,530],{},"now",[452,532,533,534,537],{},"The clock for progress. A clock stuck at ",[24,535,536],{},"0"," keeps progress silent, since a step under 2 seconds prints nothing.",[20,539,540,541,544],{},"This helper keeps everything the command writes. On a TTY it answers each prompt with the next string from ",[24,542,543],{},"answers",", and ends stdin when it runs out, which makes the prompt take its default:",[85,546,548],{"language":87,"filename":547,"class":89,"wrap":14},"test\u002Fcheck.test.ts",[24,549,550,122,564,122,578,122,594,122,608,122,622,122,624,122,648,122,689,122,691,122,696,122,739,122,754,122,767,122,792,122,809,122,814,122,849,122,854,122,859,122,875,122,885,122,914,122,932,122,985,122,990,122,995,122,1000,122,1014,122,1019,122,1044],{"class":92},[94,551,552,554,557,559,562],{"class":96,"style":97},[94,553,101],{"style":100},[94,555,556],{"style":104}," { readFileSync } ",[94,558,114],{"style":100},[94,560,561],{"style":117}," \"node:fs\"",[94,563,121],{"style":104},[94,565,566,568,571,573,576],{"class":96,"style":97},[94,567,101],{"style":100},[94,569,570],{"style":104}," { PassThrough } ",[94,572,114],{"style":100},[94,574,575],{"style":117}," \"node:stream\"",[94,577,121],{"style":104},[94,579,580,582,585,588,590,592],{"class":96,"style":97},[94,581,101],{"style":100},[94,583,584],{"style":100}," type",[94,586,587],{"style":104}," { Detection, Env, Io } ",[94,589,114],{"style":100},[94,591,118],{"style":117},[94,593,121],{"style":104},[94,595,596,598,601,603,606],{"class":96,"style":97},[94,597,101],{"style":100},[94,599,600],{"style":104}," { describe, expect, it } ",[94,602,114],{"style":100},[94,604,605],{"style":117}," \"vitest\"",[94,607,121],{"style":104},[94,609,610,612,615,617,620],{"class":96,"style":97},[94,611,101],{"style":100},[94,613,614],{"style":104}," { check } ",[94,616,114],{"style":100},[94,618,619],{"style":117}," \"..\u002Fsrc\u002Fcheck.ts\"",[94,621,121],{"style":104},[94,623],{"class":96,"style":97},[94,625,626,629,632,634,637,640,642,644,646],{"class":96,"style":97},[94,627,628],{"style":100},"const",[94,630,631],{"style":138}," golden",[94,633,224],{"style":100},[94,635,636],{"style":104}," (",[94,638,639],{"style":147},"name",[94,641,151],{"style":100},[94,643,155],{"style":154},[94,645,309],{"style":104},[94,647,312],{"style":100},[94,649,650,653,655,658,661,663,666,668,671,673,675,677,680,683,686],{"class":96,"style":97},[94,651,652],{"style":138},"  readFileSync",[94,654,142],{"style":104},[94,656,657],{"style":100},"new",[94,659,660],{"style":138}," URL",[94,662,142],{"style":104},[94,664,665],{"style":117},"`.\u002Fgolden\u002F${",[94,667,639],{"style":104},[94,669,670],{"style":117},"}`",[94,672,177],{"style":104},[94,674,101],{"style":100},[94,676,35],{"style":104},[94,678,679],{"style":154},"meta",[94,681,682],{"style":104},".url), ",[94,684,685],{"style":117},"\"utf8\"",[94,687,688],{"style":104},");",[94,690],{"class":96,"style":97},[94,692,693],{"class":96,"style":97},[94,694,695],{"style":398},"\u002F** Streams that keep what the command writes. On a TTY, each prompt gets the next answer. *\u002F",[94,697,698,701,704,706,708,710,713,715,718,720,723,725,727,729,731,734,736],{"class":96,"style":97},[94,699,700],{"style":100},"function",[94,702,703],{"style":138}," fakeIo",[94,705,142],{"style":104},[94,707,456],{"style":147},[94,709,151],{"style":100},[94,711,712],{"style":147}," Env",[94,714,177],{"style":104},[94,716,717],{"style":147},"tty",[94,719,151],{"style":100},[94,721,722],{"style":154}," boolean",[94,724,177],{"style":104},[94,726,543],{"style":147},[94,728,151],{"style":100},[94,730,155],{"style":154},[94,732,733],{"style":104},"[] ",[94,735,192],{"style":100},[94,737,738],{"style":104}," []) {",[94,740,741,744,747,749,752],{"class":96,"style":97},[94,742,743],{"style":100},"  let",[94,745,746],{"style":104}," stdout ",[94,748,192],{"style":100},[94,750,751],{"style":117}," \"\"",[94,753,121],{"style":104},[94,755,756,758,761,763,765],{"class":96,"style":97},[94,757,743],{"style":100},[94,759,760],{"style":104}," stderr ",[94,762,192],{"style":100},[94,764,751],{"style":117},[94,766,121],{"style":104},[94,768,769,771,774,776,779,782,784,786,789],{"class":96,"style":97},[94,770,218],{"style":100},[94,772,773],{"style":154}," stdin",[94,775,224],{"style":100},[94,777,778],{"style":104}," Object.",[94,780,781],{"style":138},"assign",[94,783,142],{"style":104},[94,785,657],{"style":100},[94,787,788],{"style":138}," PassThrough",[94,790,791],{"style":104},"(), { isTTY: tty });",[94,793,794,796,799,801,804,806],{"class":96,"style":97},[94,795,218],{"style":100},[94,797,798],{"style":154}," io",[94,800,151],{"style":100},[94,802,803],{"style":147}," Io",[94,805,224],{"style":100},[94,807,808],{"style":104}," {",[94,810,811],{"class":96,"style":97},[94,812,813],{"style":104},"    env,",[94,815,816,819,822,824,827,829,832,834,836,838,840,843,846],{"class":96,"style":97},[94,817,818],{"style":104},"    stdout: { isTTY: tty, columns: ",[94,820,821],{"style":154},"120",[94,823,177],{"style":104},[94,825,826],{"style":138},"write",[94,828,303],{"style":104},[94,830,831],{"style":147},"chunk",[94,833,151],{"style":100},[94,835,155],{"style":154},[94,837,309],{"style":104},[94,839,312],{"style":100},[94,841,842],{"style":104}," (stdout ",[94,844,845],{"style":100},"+=",[94,847,848],{"style":104}," chunk) },",[94,850,851],{"class":96,"style":97},[94,852,853],{"style":104},"    stderr: {",[94,855,856],{"class":96,"style":97},[94,857,858],{"style":104},"      isTTY: tty,",[94,860,861,864,866,868,870,872],{"class":96,"style":97},[94,862,863],{"style":138},"      write",[94,865,142],{"style":104},[94,867,831],{"style":147},[94,869,151],{"style":100},[94,871,155],{"style":154},[94,873,874],{"style":104},") {",[94,876,877,880,882],{"class":96,"style":97},[94,878,879],{"style":104},"        stderr ",[94,881,845],{"style":100},[94,883,884],{"style":104}," chunk;",[94,886,887,890,892,895,898,901,903,906,909,912],{"class":96,"style":97},[94,888,889],{"style":100},"        if",[94,891,636],{"style":104},[94,893,894],{"style":100},"!",[94,896,897],{"style":104},"chunk.",[94,899,900],{"style":138},"startsWith",[94,902,142],{"style":104},[94,904,905],{"style":117},"\"? \"",[94,907,908],{"style":104},")) ",[94,910,911],{"style":100},"return",[94,913,121],{"style":104},[94,915,916,919,922,924,927,930],{"class":96,"style":97},[94,917,918],{"style":100},"        const",[94,920,921],{"style":154}," answer",[94,923,224],{"style":100},[94,925,926],{"style":104}," answers.",[94,928,929],{"style":138},"shift",[94,931,413],{"style":104},[94,933,934,937,940,942,945,947,949,952,955,957,960,962,964,966,968,971,974,976,979,982],{"class":96,"style":97},[94,935,936],{"style":138},"        setImmediate",[94,938,939],{"style":104},"(() ",[94,941,312],{"style":100},[94,943,944],{"style":104}," (answer ",[94,946,320],{"style":100},[94,948,323],{"style":154},[94,950,951],{"style":100}," ?",[94,953,954],{"style":104}," stdin.",[94,956,410],{"style":138},[94,958,959],{"style":104},"() ",[94,961,151],{"style":100},[94,963,954],{"style":104},[94,965,826],{"style":138},[94,967,142],{"style":104},[94,969,970],{"style":117},"`${",[94,972,973],{"style":104},"answer",[94,975,418],{"style":117},[94,977,978],{"style":100},"\\n",[94,980,981],{"style":117},"`",[94,983,984],{"style":104},")));",[94,986,987],{"class":96,"style":97},[94,988,989],{"style":104},"      },",[94,991,992],{"class":96,"style":97},[94,993,994],{"style":104},"    },",[94,996,997],{"class":96,"style":97},[94,998,999],{"style":104},"    stdin,",[94,1001,1002,1005,1008,1010,1012],{"class":96,"style":97},[94,1003,1004],{"style":138},"    now",[94,1006,1007],{"style":104},": () ",[94,1009,312],{"style":100},[94,1011,362],{"style":154},[94,1013,262],{"style":104},[94,1015,1016],{"class":96,"style":97},[94,1017,1018],{"style":104},"  };",[94,1020,1021,1023,1026,1028,1030,1032,1035,1037,1039,1041],{"class":96,"style":97},[94,1022,404],{"style":100},[94,1024,1025],{"style":104}," { io, ",[94,1027,480],{"style":138},[94,1029,1007],{"style":104},[94,1031,312],{"style":100},[94,1033,1034],{"style":104}," stdout, ",[94,1036,501],{"style":138},[94,1038,1007],{"style":104},[94,1040,312],{"style":100},[94,1042,1043],{"style":104}," stderr };",[94,1045,1046],{"class":96,"style":97},[94,1047,418],{"style":104},[20,1049,1050,1051,1054,1055,466,1058,1061,1062,1065],{},"Prompts start with ",[24,1052,1053],{},"? "," on stderr, and readerly reads the answer from ",[24,1056,1057],{},"io.stdin",[24,1059,1060],{},"node:readline",". ",[24,1063,1064],{},"setImmediate"," writes the answer after the prompt is on screen, as a person would.",[59,1067,1071],{"id":1068,"anchor":1069},"one-test-per-reader",{"label":1070,"icon":64},"Section titled \"One test per reader\"","One test per reader",[20,1073,1074],{},"The same file goes on with one test for each reader. Each test sets only the variables that reader would have:",[85,1076,1077],{"language":87,"filename":547,"class":89,"wrap":14},[24,1078,1079,122,1096,122,1118,122,1157,122,1181,122,1208,122,1227,122,1231,122,1233,122,1252,122,1275,122,1295,122,1318,122,1337,122,1341,122,1343,122,1362,122,1389,122,1409,122,1432,122,1455,122,1459,122,1461,122,1480,122,1497,122,1529,122,1556,122,1566,122,1576,122,1597,122,1602,122,1606],{"class":92},[94,1080,1081,1084,1086,1089,1092,1094],{"class":96,"style":97},[94,1082,1083],{"style":138},"describe",[94,1085,142],{"style":104},[94,1087,1088],{"style":117},"\"acme check\"",[94,1090,1091],{"style":104},", () ",[94,1093,312],{"style":100},[94,1095,808],{"style":104},[94,1097,1098,1101,1103,1106,1108,1111,1114,1116],{"class":96,"style":97},[94,1099,1100],{"style":138},"  it",[94,1102,142],{"style":104},[94,1104,1105],{"style":117},"\"prints findings, then asks, at a terminal\"",[94,1107,177],{"style":104},[94,1109,1110],{"style":100},"async",[94,1112,1113],{"style":104}," () ",[94,1115,312],{"style":100},[94,1117,808],{"style":104},[94,1119,1120,1123,1126,1128,1130,1133,1136,1139,1142,1145,1148,1151,1154],{"class":96,"style":97},[94,1121,1122],{"style":100},"    const",[94,1124,1125],{"style":154}," run",[94,1127,224],{"style":100},[94,1129,703],{"style":138},[94,1131,1132],{"style":104},"({ TERM: ",[94,1134,1135],{"style":117},"\"xterm-256color\"",[94,1137,1138],{"style":104},", NO_COLOR: ",[94,1140,1141],{"style":117},"\"1\"",[94,1143,1144],{"style":104}," }, ",[94,1146,1147],{"style":154},"true",[94,1149,1150],{"style":104},", [",[94,1152,1153],{"style":117},"\"n\"",[94,1155,1156],{"style":104},"]);",[94,1158,1159,1162,1164,1167,1169,1172,1175,1177,1179],{"class":96,"style":97},[94,1160,1161],{"style":138},"    expect",[94,1163,142],{"style":104},[94,1165,1166],{"style":100},"await",[94,1168,139],{"style":138},[94,1170,1171],{"style":104},"([], { io: run.io })).",[94,1173,1174],{"style":138},"toBe",[94,1176,142],{"style":104},[94,1178,381],{"style":154},[94,1180,688],{"style":104},[94,1182,1183,1185,1188,1190,1193,1195,1197,1200,1202,1205],{"class":96,"style":97},[94,1184,1161],{"style":138},[94,1186,1187],{"style":104},"(run.",[94,1189,480],{"style":138},[94,1191,1192],{"style":104},"()).",[94,1194,1174],{"style":138},[94,1196,142],{"style":104},[94,1198,1199],{"style":138},"golden",[94,1201,142],{"style":104},[94,1203,1204],{"style":117},"\"terminal.stdout.txt\"",[94,1206,1207],{"style":104},"));",[94,1209,1210,1212,1214,1216,1218,1220,1222,1225],{"class":96,"style":97},[94,1211,1161],{"style":138},[94,1213,1187],{"style":104},[94,1215,501],{"style":138},[94,1217,1192],{"style":104},[94,1219,1174],{"style":138},[94,1221,142],{"style":104},[94,1223,1224],{"style":117},"\"? Apply 2 safe fixes? (y\u002FN) \"",[94,1226,688],{"style":104},[94,1228,1229],{"class":96,"style":97},[94,1230,393],{"style":104},[94,1232],{"class":96,"style":97},[94,1234,1235,1237,1239,1242,1244,1246,1248,1250],{"class":96,"style":97},[94,1236,1100],{"style":138},[94,1238,142],{"style":104},[94,1240,1241],{"style":117},"\"gives a coding agent the compact report\"",[94,1243,177],{"style":104},[94,1245,1110],{"style":100},[94,1247,1113],{"style":104},[94,1249,312],{"style":100},[94,1251,808],{"style":104},[94,1253,1254,1256,1258,1260,1262,1265,1268,1270,1273],{"class":96,"style":97},[94,1255,1122],{"style":100},[94,1257,1125],{"style":154},[94,1259,224],{"style":100},[94,1261,703],{"style":138},[94,1263,1264],{"style":104},"({ AI_AGENT: ",[94,1266,1267],{"style":117},"\"claude-code\"",[94,1269,1144],{"style":104},[94,1271,1272],{"style":154},"false",[94,1274,688],{"style":104},[94,1276,1277,1279,1281,1283,1285,1287,1289,1291,1293],{"class":96,"style":97},[94,1278,1161],{"style":138},[94,1280,142],{"style":104},[94,1282,1166],{"style":100},[94,1284,139],{"style":138},[94,1286,1171],{"style":104},[94,1288,1174],{"style":138},[94,1290,142],{"style":104},[94,1292,381],{"style":154},[94,1294,688],{"style":104},[94,1296,1297,1299,1301,1303,1305,1307,1309,1311,1313,1316],{"class":96,"style":97},[94,1298,1161],{"style":138},[94,1300,1187],{"style":104},[94,1302,480],{"style":138},[94,1304,1192],{"style":104},[94,1306,1174],{"style":138},[94,1308,142],{"style":104},[94,1310,1199],{"style":138},[94,1312,142],{"style":104},[94,1314,1315],{"style":117},"\"agent.stdout.txt\"",[94,1317,1207],{"style":104},[94,1319,1320,1322,1324,1326,1328,1330,1332,1335],{"class":96,"style":97},[94,1321,1161],{"style":138},[94,1323,1187],{"style":104},[94,1325,501],{"style":138},[94,1327,1192],{"style":104},[94,1329,1174],{"style":138},[94,1331,142],{"style":104},[94,1333,1334],{"style":117},"\"\"",[94,1336,688],{"style":104},[94,1338,1339],{"class":96,"style":97},[94,1340,393],{"style":104},[94,1342],{"class":96,"style":97},[94,1344,1345,1347,1349,1352,1354,1356,1358,1360],{"class":96,"style":97},[94,1346,1100],{"style":138},[94,1348,142],{"style":104},[94,1350,1351],{"style":117},"\"annotates files on GitHub Actions\"",[94,1353,177],{"style":104},[94,1355,1110],{"style":100},[94,1357,1113],{"style":104},[94,1359,312],{"style":100},[94,1361,808],{"style":104},[94,1363,1364,1366,1368,1370,1372,1375,1378,1381,1383,1385,1387],{"class":96,"style":97},[94,1365,1122],{"style":100},[94,1367,1125],{"style":154},[94,1369,224],{"style":100},[94,1371,703],{"style":138},[94,1373,1374],{"style":104},"({ CI: ",[94,1376,1377],{"style":117},"\"true\"",[94,1379,1380],{"style":104},", GITHUB_ACTIONS: ",[94,1382,1377],{"style":117},[94,1384,1144],{"style":104},[94,1386,1272],{"style":154},[94,1388,688],{"style":104},[94,1390,1391,1393,1395,1397,1399,1401,1403,1405,1407],{"class":96,"style":97},[94,1392,1161],{"style":138},[94,1394,142],{"style":104},[94,1396,1166],{"style":100},[94,1398,139],{"style":138},[94,1400,1171],{"style":104},[94,1402,1174],{"style":138},[94,1404,142],{"style":104},[94,1406,381],{"style":154},[94,1408,688],{"style":104},[94,1410,1411,1413,1415,1417,1419,1421,1423,1425,1427,1430],{"class":96,"style":97},[94,1412,1161],{"style":138},[94,1414,1187],{"style":104},[94,1416,480],{"style":138},[94,1418,1192],{"style":104},[94,1420,1174],{"style":138},[94,1422,142],{"style":104},[94,1424,1199],{"style":138},[94,1426,142],{"style":104},[94,1428,1429],{"style":117},"\"actions.stdout.txt\"",[94,1431,1207],{"style":104},[94,1433,1434,1436,1438,1440,1442,1444,1446,1448,1450,1453],{"class":96,"style":97},[94,1435,1161],{"style":138},[94,1437,1187],{"style":104},[94,1439,501],{"style":138},[94,1441,1192],{"style":104},[94,1443,1174],{"style":138},[94,1445,142],{"style":104},[94,1447,1199],{"style":138},[94,1449,142],{"style":104},[94,1451,1452],{"style":117},"\"actions.stderr.txt\"",[94,1454,1207],{"style":104},[94,1456,1457],{"class":96,"style":97},[94,1458,393],{"style":104},[94,1460],{"class":96,"style":97},[94,1462,1463,1465,1467,1470,1472,1474,1476,1478],{"class":96,"style":97},[94,1464,1100],{"style":138},[94,1466,142],{"style":104},[94,1468,1469],{"style":117},"\"prints one JSON document with --format json\"",[94,1471,177],{"style":104},[94,1473,1110],{"style":100},[94,1475,1113],{"style":104},[94,1477,312],{"style":100},[94,1479,808],{"style":104},[94,1481,1482,1484,1486,1488,1490,1493,1495],{"class":96,"style":97},[94,1483,1122],{"style":100},[94,1485,1125],{"style":154},[94,1487,224],{"style":100},[94,1489,703],{"style":138},[94,1491,1492],{"style":104},"({}, ",[94,1494,1272],{"style":154},[94,1496,688],{"style":104},[94,1498,1499,1501,1503,1505,1507,1510,1513,1515,1518,1521,1523,1525,1527],{"class":96,"style":97},[94,1500,1161],{"style":138},[94,1502,142],{"style":104},[94,1504,1166],{"style":100},[94,1506,139],{"style":138},[94,1508,1509],{"style":104},"([",[94,1511,1512],{"style":117},"\"--format\"",[94,1514,177],{"style":104},[94,1516,1517],{"style":117},"\"json\"",[94,1519,1520],{"style":104},"], { io: run.io })).",[94,1522,1174],{"style":138},[94,1524,142],{"style":104},[94,1526,381],{"style":154},[94,1528,688],{"style":104},[94,1530,1531,1533,1535,1538,1540,1543,1545,1547,1550,1553],{"class":96,"style":97},[94,1532,1161],{"style":138},[94,1534,142],{"style":104},[94,1536,1537],{"style":154},"JSON",[94,1539,35],{"style":104},[94,1541,1542],{"style":138},"parse",[94,1544,1187],{"style":104},[94,1546,480],{"style":138},[94,1548,1549],{"style":104},"())).",[94,1551,1552],{"style":138},"toMatchObject",[94,1554,1555],{"style":104},"({",[94,1557,1558,1561,1564],{"class":96,"style":97},[94,1559,1560],{"style":104},"      schema: ",[94,1562,1563],{"style":117},"\"acme.check\u002Fv1\"",[94,1565,262],{"style":104},[94,1567,1568,1571,1574],{"class":96,"style":97},[94,1569,1570],{"style":104},"      status: ",[94,1572,1573],{"style":117},"\"failed\"",[94,1575,262],{"style":104},[94,1577,1578,1581,1584,1587,1589,1592,1594],{"class":96,"style":97},[94,1579,1580],{"style":104},"      summary: { error: ",[94,1582,1583],{"style":154},"2",[94,1585,1586],{"style":104},", warn: ",[94,1588,381],{"style":154},[94,1590,1591],{"style":104},", info: ",[94,1593,536],{"style":154},[94,1595,1596],{"style":104}," },",[94,1598,1599],{"class":96,"style":97},[94,1600,1601],{"style":104},"    });",[94,1603,1604],{"class":96,"style":97},[94,1605,393],{"style":104},[94,1607,1608],{"class":96,"style":97},[94,1609,1610],{"style":104},"});",[20,1612,1613,1616,1617,1620],{},[24,1614,1615],{},"NO_COLOR: \"1\""," keeps escape codes out of the terminal golden. To test color, set ",[24,1618,1619],{},"FORCE_COLOR: \"1\""," instead and keep a second golden.",[20,1622,1623,1624,1627],{},"The agent's golden, ",[24,1625,1626],{},"agent.stdout.txt",", holds:",[85,1629,1631],{"language":1630,"class":89,"wrap":14},"text",[24,1632,1634,122,1639,122,1644,122,1649,122,1654,122,1659],{"class":1633},"language-text",[94,1635,1636],{"class":96,"style":97},[94,1637,1638],{},"acme check: failed. 2 errors, 1 warning in 212 files (0.8s).",[94,1640,1641],{"class":96,"style":97},[94,1642,1643],{},"error ACME001 src\u002Fapp.ts:14:3 Route handler reads process.env at module scope. fix: Read it inside the handler",[94,1645,1646],{"class":96,"style":97},[94,1647,1648],{},"error ACME004 src\u002Fdb.ts:3:1 Top-level await in a server entry. fix: Move the call into the plugin setup",[94,1650,1651],{"class":96,"style":97},[94,1652,1653],{},"warn ACME010 vite.config.ts:8:5 Alias shadows a workspace package",[94,1655,1656],{"class":96,"style":97},[94,1657,1658],{},"next: acme check --fix   (applies 2 safe fixes)",[94,1660,1661],{"class":96,"style":97},[94,1662,1663],{},"next: acme explain \u003Ccode>   (explains one code)",[59,1665,1669],{"id":1666,"anchor":1667},"golden-files",{"label":1668,"icon":64},"Section titled \"Golden files\"","Golden files",[20,1671,1672,1673,177,1676,177,1678,177,1681,1684,1685,1687,1688,35],{},"Keep one file per reader and stream, named after both: ",[24,1674,1675],{},"terminal.stdout.txt",[24,1677,1626],{},[24,1679,1680],{},"actions.stderr.txt",[24,1682,1683],{},"json.stdout.json",". Compare them with ",[24,1686,1174],{},", never with a loose match, so a changed space or glyph fails the test. Write each file once from a run you read line by line, then commit it. readerly's own goldens are in ",[40,1689,1691],{"href":1690},"https:\u002F\u002Fgithub.com\u002Floadsheet\u002Freaderly\u002Ftree\u002Fmain\u002Ftest\u002Fgolden",[24,1692,1693],{},"test\u002Fgolden\u002F",[20,1695,1696,1697,1699,1700,1703,1704,1706,1707,1710],{},"To test the order of writes, such as findings before a prompt, keep every chunk in an array tagged with its stream instead of two strings. ",[24,1698,45],{}," checks that the ",[24,1701,1702],{},"ACME010"," row comes before the ",[24,1705,1053],{}," prompt and the ",[24,1708,1709],{},"next:"," line after it.",[59,1712,1716],{"id":1713,"anchor":1714},"skip-detection",{"label":1715,"icon":64},"Section titled \"Skip detection\"","Skip detection",[20,1718,1719,469,1721,1724,1725,1727],{},[24,1720,75],{},[24,1722,1723],{},"detect()",", so the environment no longer picks the reader. It still decides ",[24,1726,462],{}," and color. Use it to test one reader without building its environment:",[85,1729,1730],{"language":87,"filename":547,"class":89,"wrap":14},[24,1731,1732,122,1752,122,1768,122,1778,122,1788,122,1797,122,1806,122,1815,122,1819,122,1839,122,1861,122,1881],{"class":92},[94,1733,1734,1737,1739,1742,1744,1746,1748,1750],{"class":96,"style":97},[94,1735,1736],{"style":138},"it",[94,1738,142],{"style":104},[94,1740,1741],{"style":117},"\"takes a fixed detection instead of reading env\"",[94,1743,177],{"style":104},[94,1745,1110],{"style":100},[94,1747,1113],{"style":104},[94,1749,312],{"style":100},[94,1751,808],{"style":104},[94,1753,1754,1756,1759,1761,1764,1766],{"class":96,"style":97},[94,1755,218],{"style":100},[94,1757,1758],{"style":154}," pipe",[94,1760,151],{"style":100},[94,1762,1763],{"style":147}," Detection",[94,1765,224],{"style":100},[94,1767,808],{"style":104},[94,1769,1770,1773,1776],{"class":96,"style":97},[94,1771,1772],{"style":104},"    reader: ",[94,1774,1775],{"style":117},"\"pipe\"",[94,1777,262],{"style":104},[94,1779,1780,1783,1786],{"class":96,"style":97},[94,1781,1782],{"style":104},"    reason: ",[94,1784,1785],{"style":117},"\"test\"",[94,1787,262],{"style":104},[94,1789,1790,1793,1795],{"class":96,"style":97},[94,1791,1792],{"style":104},"    stdout: { isTTY: ",[94,1794,1272],{"style":154},[94,1796,1596],{"style":104},[94,1798,1799,1802,1804],{"class":96,"style":97},[94,1800,1801],{"style":104},"    stderr: { isTTY: ",[94,1803,1272],{"style":154},[94,1805,1596],{"style":104},[94,1807,1808,1811,1813],{"class":96,"style":97},[94,1809,1810],{"style":104},"    stdin: { isTTY: ",[94,1812,1272],{"style":154},[94,1814,1596],{"style":104},[94,1816,1817],{"class":96,"style":97},[94,1818,1018],{"style":104},[94,1820,1821,1823,1825,1827,1829,1831,1833,1835,1837],{"class":96,"style":97},[94,1822,218],{"style":100},[94,1824,1125],{"style":154},[94,1826,224],{"style":100},[94,1828,703],{"style":138},[94,1830,1264],{"style":104},[94,1832,1267],{"style":117},[94,1834,1144],{"style":104},[94,1836,1272],{"style":154},[94,1838,688],{"style":104},[94,1840,1841,1844,1846,1848,1850,1853,1855,1857,1859],{"class":96,"style":97},[94,1842,1843],{"style":138},"  expect",[94,1845,142],{"style":104},[94,1847,1166],{"style":100},[94,1849,139],{"style":138},[94,1851,1852],{"style":104},"([], { io: run.io, detection: pipe })).",[94,1854,1174],{"style":138},[94,1856,142],{"style":104},[94,1858,381],{"style":154},[94,1860,688],{"style":104},[94,1862,1863,1865,1867,1869,1871,1874,1876,1879],{"class":96,"style":97},[94,1864,1843],{"style":138},[94,1866,1187],{"style":104},[94,1868,480],{"style":138},[94,1870,1192],{"style":104},[94,1872,1873],{"style":138},"toContain",[94,1875,142],{"style":104},[94,1877,1878],{"style":117},"\"next: acme check --fix   (applies 2 safe fixes)\"",[94,1880,688],{"style":104},[94,1882,1883],{"class":96,"style":97},[94,1884,1610],{"style":104},[20,1886,1887,1890,1891,1893,1894,35],{},[24,1888,1889],{},"AI_AGENT"," is set, but the fixed detection says ",[24,1892,494],{},", so the command prints ",[24,1895,1630],{},[20,1897,1898,1899,35],{},"For a table of environments and flags with the reader and profile each one gets, see ",[40,1900,1902],{"href":1901},"https:\u002F\u002Fgithub.com\u002Floadsheet\u002Freaderly\u002Fblob\u002Fmain\u002Ftest\u002Freader-matrix.test.ts",[24,1903,1904],{},"test\u002Freader-matrix.test.ts",[1906,1908,1909,1910,1911],{"id":61,"depth":1907,"text":65},2,{"id":421,"depth":1907,"text":424},{"id":1068,"depth":1907,"text":1071},{"id":1666,"depth":1907,"text":1669},{"id":1713,"depth":1907,"text":1716},{"path":1913,"title":1914,"description":1915},"\u002Fintegrations\u002Fargument-parsers","Argument parsers","Use readerly with node:util parseArgs or cac. readerFlags takes the shared reader flags and hands the rest of argv to your parser.",{"path":1917,"title":1918,"description":1919},"\u002Fintegrations\u002Fprogress","Progress","How out.progress and createProgress show a long step: a live bar on a terminal, a line every 5 seconds in CI and pipes, nothing for agents or JSON.",1795985395484,"22ea5d7b-bce0-4e3b-bca3-1fbe3722fcf7"]