@skyramp/testbot-core 0.13.0-v3.362 → 0.13.0-v3.363

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/VERSION.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.13.0-v3.362","commit":"d8c93d81649bdb3b633dcd5e96796e402664fb9e"}
1
+ {"version":"0.13.0-v3.363","commit":"b2ee3f9b9399d29ea26473f03127cad5fdeeb9fd"}
package/dist/main.js CHANGED
@@ -831,7 +831,7 @@ Fix them in the test files, not the type-check config, and run it again`)}return
831
831
  with a short per-test timeout so a hung test fails`,` fast; wait for the run to finish (one Bash call may run up to ${l3} minutes), and don't end the session with a test`," run still going: the session is non-interactive and ends when you stop, so nothing would report its result."," A run that never finishes (the runner hangs or times out as a whole, not one test failing) is the environment's,"," not your tests': don't run it again with a longer timeout. Record those files as not run (exit null), with the",` runner's last output as the failure, and go on with the rest.${$Ur(e)}`,"3. For each failure, work out whose fault it is, and settle it outside the test before you call it a defect. The"," outcome the test expects must be one the PR, spec, code or plan requires, not one you chose: an exact status where only a"," refusal is required, a message or format nothing states, a value read from a column picked by position. Where only"," part of it is required, assert only that part. A failure before the step that checks the case (sign-in, setup,"," seeding, a helper, an element not found, a timeout) is the test's until you have seen the app do it wrong: look at"," the page or send the request yourself, and find the line of application code that does it."," If the test checks what its case requires and the app does something else, that's a defect in the change: keep the"," test as written, mark the case and its file as a defect, and report the bug with that line. Never change an expected"," outcome to match what the app does. If the test itself is wrong (selector, setup, data, import, timing, an outcome"," nothing requires), fix it and re-run only the tests that failed (e.g. pytest --lf, playwright test --last-failed, or"," by name); a failing case you could not fix is marked defect: false, never a defect. Give each failing case the",` runner's failure as it printed it ("failure"), and each case you keep as a defect its "cause", the application line,`,` and "requires", the words of the PR description, a requirement or clause of the plan, or the code a finding's "keeps" names, that state what its failing check expects \u2014`,` or, for a case whose finding names a rule every app keeps under "rule", that rule's sentence whole: ${aM()}`," quoted. When no words state it, the check asserts more than is required: assert only what is, and re-run it."," Keep each run's full output and the runner's own report (JUnit XML or JSON) in a file under /tmp, and read what"," failed from that file rather than running the tests again to see more: output piped through grep, tail or head is"," lost to the next look. Re-run only the tests that failed, by name. Don't re-run the whole set at"," the end: the results you already have stand.","4. Then run the repo's existing test files that reach the code the change touches, the way its CI runs them (its"," command and environment), each file whole, never narrowed to named tests and never only listed: the whole suite"," only when it runs in a few minutes. Run each once, its output kept as above. A run that does not finish (it hangs,"," or waits on a network or service this run cannot reach) has its result too: note where it stopped, run by name only"," the tests in it that reach the change, with any they depend on, and don't run the whole of it again. Every existing"," test to maintain above is run and listed in tests with its result; one you could not run is listed in notWritten by"," its path, with why it could not run. For each one that fails, find out"," whether this change made it fail; when you can't tell, run it on the base branch in a scratch copy outside the"," checkout (e.g. git worktree add under /tmp). One that asserts behaviour the change deliberately replaced is stale:"," update it, or delete it where nothing it checks is left, and re-run it. When only part of what it checks is gone (a"," control removed from a page that stays), update it in place, even if the plan says delete: it keeps checking the"," rest and now checks that the part is gone. Give staleBecause for it, one you delete listed as deleted \u2014 the requirement the"," change deliberately alters and the changed line of application code (path:line) that alters it. One that catches"," something the change breaks is a defect: leave it failing and report it. Leave alone failures the change did not cause."," A new case is a new test, even in an existing test file: a test the change leaves working keeps its statements, so"," the reviewer sees only the edits the change needs.","5. If the repo has a linter or formatter for test code, run it on your files of the kinds its lint script covers (one"," that lints `--ext js,jsx` never lints a .ts spec), and record the exact command you ran: Testbot re-runs it, and"," sends back what it still reports. Run each linter the repo configures for your files (a formatter alone is not one),"," with the repo's own config, from the repository: a copied config matches its file patterns where the copy is.",...(()=>{let $=yCt(e.inputs.repositoryPath);return $.length?[" The repo holds its code to these checks, found in its CI, scripts and configs; run them on your files:",...$," Before delivery Testbot formats your files with those formatters, re-runs its linters on them, and sends back"," what they report."]:[]})()," Where the repo has a type-check script (typecheck, check-types, tsc), run it too and fix what it reports in your"," files: a test runner does not check types, so a test that passes can still fail the repo's CI on its types."," The application's manifests and"," lockfiles are its owner's: a test in the repo's own framework uses only what the repo already declares, and you"," never add, upgrade or remove a package in the application's own manifests or lockfiles for Testbot's tests,"," a reporter for your own run included: use a report the runner writes itself.",b?" For the app's code, reach it the way the repo's in-process tests do (its test client, fixtures and helpers).":" For calls to the app, use the client and helpers the repo's existing tests use for that service."," A browser test goes in the repo's own browser suite where it has one (Selenium, Cypress, Capybara), with its page objects."," A test reads no environment variable the repository does not define unless it gives it a working default: the"," repo's CI sets only its own, so reach what the test needs the way that CI does."," Tooling the repo doesn't declare (Playwright where it has none) goes in the Testbot test package"," above, never in the application's manifests; with no such package, write the test with what the repo has."," The one exception is a test that must run inside the application's existing test environment and cannot"," without a package it lacks: add it to the manifest of the checkout the test is in, keep the manifest's"," constraints, upgrade nothing else, update that manifest's lockfile with its own package manager (the updated lockfile"," must name the added package), run the existing tests of that environment, and list it in dependenciesAdded"," with the reason and the manifest's path relative to its checkout; for another checkout of the change,"," name that checkout as the entry's repository (its owner/repo).","","Find how this repository checks commit messages and PR titles, and follow it.","",'In your result, give each file you added or updated its "functions": each test function in it as the runner names',"it, with the plan case ids it checks, so that every case it covers is checked by a function you name, and give each","id in its covers its own result under result.cases. Give each","issue its plan finding id and the requirement or clause ids it violates. Name each test for what it checks: no plan","id in a test's name or title, except a label the description or spec itself gives the requirement (AC-3).","","Apart from that scratch copy, stay inside the checkout and leave it on the commit it is on,","with the change's files in place: run or read the base in the scratch copy (or with git show <commit>:<file>), never","by checking the checkout out, resetting or stashing it. Don't commit or push, and leave the tests in the working tree.",`Write your result as JSON (below) to ${t.checkpoint} and keep it current as you go: that file is what's`,"read. End with a one-line final message \u2014 don't repeat the JSON in it. The report is read by the PR author: describe","their code, not this process.","For each Change Set repository where you added or updated no tests, give report.noTests its owner/repo and","the reason. If its tests went to another repository, name that repository. Re-running an unchanged test does","not add or update a test; explain when existing tests were enough. Do not invent an explanation.","",Xl(Ir)].join(`
832
832
  `)}function OUr(e,t){let r=t.skyrampApi?.helper?.env.SKYRAMP_API_SDK;return r&&t.skyrampApi?.decision.placement==="test-package"?k3(r):_N(e)?tj(e.inputs.skyrampMcp):void 0}function LT(e,t,r){let n=vt.join(e.outputsDir,t);return Ps.writeFileSync(n,JSON.stringify(Ur(r,e.secretValues??[]),null,2)+`
833
833
  `),vt.relative(e.runDir,n)}function lIt(e,t){return _B(t.dependenciesAdded??[],Bn(e.inputs.repositoryPath,e.inputs.relatedRepos??[])).added}function qxe(e,t){let r=e.prepared?.dependencyBaseline??new Set;return[...sve(e,t,r),...swt(e)]}var MUr={name:sIt,verify(e,t){let{value:r}=ir(Ir,t.stdout,Ht(e),e.secretValues);if(!r)return{name:this.name,passed:!0};let n=qxe(e,lIt(e,r));return n.length?{...Wt(this.name,n),repairable:!0}:{name:this.name,passed:!0}}};function QUr(e,t){let r=me(e,ou);if(!r)return[];let n=Bn(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),i=r.packages.filter(s=>{try{let o=vt.resolve(s.repository?Sh(e.inputs,s.repository):e.inputs.repositoryPath),a=t.tests.map(u=>n(u.file)).filter(u=>vt.resolve(u.root)===o).map(u=>u.rel),c=dWe(o,s,a);return c?Rt(e).info(`[write] no test went in the new test package ${s.dir}: removed it`):s.dependencies=uj(o,s),!c}catch{return!0}});return cIt(e,i),i}function LUr(e){let t=Lv(e.commit.message),r=Lv(e.commit.prTitle).split(`
834
- `)[0],n=Lv(e.commit.prBody);return t===e.commit.message&&r===e.commit.prTitle&&n===e.commit.prBody?e:{...e,commit:{...e.commit,message:t,prTitle:r,prBody:n}}}function FUr(e,t){let{write:r,settled:n}=f3(PSe(t,me(e,"plan.json")));n.length&&Rt(e).warn(`[write] holds no test case \u2014 a support file, not a test: ${n.join(", ")}`);let i=Bn(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),s=j=>{let x=i(j);return yi(x)?{root:x.root,rel:x.rel,...x.repository?{repository:x.repository}:{}}:void 0},o=Je(process.env,UT(e)),a=Byt(Pyt(r,s,o,zw),o,zw);vUr(e,a);let c=a.roots.filter(j=>j.substituted.length);c.length&&Rt(e).warn(`[write] a browser build its Playwright declares was stood in for by another: ${c.map(j=>`${j.dir} (${j.substituted.join(", ")})`).join("; ")}`);let u=r,{write:l,settled:d}=TSt(u);d.length&&Rt(e).warn(`[write] failed before any check, with no application line \u2014 not a defect: ${d.join(", ")}`);let p;try{p=Kxe(e)}catch(j){Rt(e).warn(`[write] ${j instanceof Error?j.message:String(j)}`),p=new Map}let f=fIt(e,p),{write:h,settled:g}=DSt(l,f.texts,f.rules);g.length&&Rt(e).warn(`[write] quoted no requirement for what its failing check expects \u2014 not a defect: ${g.join(", ")}`);let y=LUr(BSe(cn(e)?wvt(h,kT(e).browserJourneys):h)),A=e.prepared?.dependencyBaseline??new Set,b=lIt(e,y),v=qxe(e,b).length?UCt(e,y,b,A):void 0,S=v?.write??y,C=zCt(Bxe(S,e.inputs.repositoryPath,e.inputs.relatedRepos??[],$xe(e))),T=C&&!S.report.nextSteps.includes(C)?{...S,report:{...S.report,nextSteps:[C,...S.report.nextSteps]}}:S;v?.reverted.length&&Rt(e).warn(`[write] undid the application dependency changes the gate refused: ${v.reverted.join(", ")}`),v?.leftOut.length&&Rt(e).warn(`[write] left out of delivery, as they need what was undone: ${v.leftOut.map(j=>`${j.file} (${j.reason})`).join("; ")}`),QUr(e,T);let R=zce(T,e.inputs.repositoryPath,e.inputs.relatedRepos??[],DJ(e,T)),D=qxe(e,R.finalize.dependencies.added);D.length&&(R.finalize.ready=!1,R.finalize.blockers=[...R.finalize.blockers,...D.slice(0,4)]);let $=aSe(e,t,e.prepared?.dependencyBaseline??new Set);$.length&&(R.finalize.ready=!1,R.finalize.blockers=[...R.finalize.blockers,...$.slice(0,4)]);let L=WSe(e,T);L.length&&(R.finalize.ready=!1,R.finalize.blockers=[...R.finalize.blockers,...L.slice(0,4)]),R.dropped.length&&Rt(e).warn(`[write] not on disk, left out of adapt.json: ${R.dropped.join(", ")}`),R.ambiguous.length&&Rt(e).warn(`[write] in both the repo under test and a related checkout, kept the repo under test's: ${R.ambiguous.join(", ")}`);let M={write:LT(e,"write.json",T),adapt:LT(e,"adapt.json",R.adapt),generate:LT(e,"generate.json",R.generate),"generate-ui":LT(e,"generate-ui.json",R.generateUi),finalize:LT(e,"finalize.json",R.finalize),deliverable:LT(e,Sve,Mwt(e))},K=qO(e);K.length&&Rt(e).info(`[write] line endings or final newline set as .editorconfig asks: ${K.join(", ")}`),sKe(e);let te=fu(e),B=j=>t.tests.filter(x=>x.file===j).flatMap(x=>[...x.isolatedRun?[x.isolatedRun.split(/\s+/)]:[],...x.run?[x.run.argv]:[]]),P=R.placed.map(j=>({...j,runs:B(j.written)})),N=jyt(e,"write",P,j=>te.some(x=>x.file===j.file&&(x.repository??"")===(j.repository??"")));return N&&Rt(e).warn(`[write] changed after its last run, so its result is not of the delivered test: ${N.files.map(j=>j.file).join(", ")}`),{artifacts:N?{...M,"stale-results":vt.relative(e.runDir,vt.join(e.outputsDir,DO))}:M,placed:R.placed}}function Lxe(e){return!cn(e)&&(!!e.inputs.appRunning||l2(me(e,"deploy.json")))}function eIt(e){let t;try{t=JSON.parse(SE(Ht(e))??"")}catch{return[]}let r=t?.tests;return Array.isArray(r)?r.flatMap(n=>{let i=w.array(wB).safeParse(n?.context);if(typeof n?.file!="string"||!n.file.trim()||!i.success||!i.data.length)return[];let s=Array.isArray(n.covers)?n.covers.filter(o=>typeof o=="string"):[];return[{...nu(e.inputs,n.file),covers:s,context:i.data}]}):[]}var Fxe=e=>({...UT(e),...e.sutAuthEnv??{}});function UUr(e,t){let r=zce(t,e.inputs.repositoryPath,e.inputs.relatedRepos??[]),n=new Map(t.tests.map(o=>[o.file,o])),i=r.placed.map(o=>({file:o.written,context:n.get(o.written)?.context})),s=new Map(r.placed.map(o=>[`${o.repository??""}\0${o.file}`,n.get(o.written)]));return{planned:KYe(e.inputs,i,r.adapt.items.map((o,a)=>({...o,from:r.placed[a].written}))),written:o=>s.get(`${o.repository??""}\0${o.file}`)}}function jUr(e,t){return e.exit===0&&t?.change==="unchanged"&&t.result.cases.length?t.result.cases.map(r=>({case:r.case,status:r.status==="skip"?"skip":"pass",...r.status!=="skip"&&r.runtimeTargets?{runtimeTargets:r.runtimeTargets}:{}})):e.exit===0?e.covers.map(r=>{let n=t?.result.cases.find(i=>i.case===r);return{case:r,status:"pass",...n?.status!=="skip"&&n?.runtimeTargets?{runtimeTargets:n.runtimeTargets}:{}}}):t&&t.result.exit!==0?t.result.cases.map(r=>({case:r.case,status:r.status,...r.status!=="skip"&&r.runtimeTargets?{runtimeTargets:r.runtimeTargets}:{}})):t&&t.change!=="unchanged"?t.result.cases.map(r=>({case:r.case,status:r.status})):[]}async function zxe(e,t){let r=FUr(e,t),n=r.placed,i=await Nz(e,{browserUsed:cB(e,"write"),browserWithheld:Wxe(e)}),s=i?{...r.artifacts,[EA]:vt.relative(e.runDir,vt.join(e.outputsDir,`${EA}.json`))}:r.artifacts;if(cn(e))return s;if(i){Rt(e).info("[write] no videos: a shared environment's tests are not run again until the data-safety guard covers that run");let u=bJ(t,e.outputsDir,"Testbot does not yet record video of tests against a shared environment");return{...s,...u?{"ui-videos":vt.relative(e.runDir,vt.join(e.outputsDir,oa))}:{}}}if(!e.prepared?.appUrls?.urls.length){Rt(e).info("[write] no videos: the run has no address of the app to give the tests");let u=bJ(t,e.outputsDir,"Testbot had no address of the app to give the test, so it was not run again, which could have reached another app");return{...s,...u?{"ui-videos":vt.relative(e.runDir,vt.join(e.outputsDir,oa))}:{}}}let o=new Map(n.map(u=>[u.written,u])),a=()=>_yt({write:t,outputsDir:e.outputsDir,resolve:u=>{let l=o.get(u),d=l&&vt.resolve(l.root,l.file);return l&&d&&Ps.existsSync(d)&&Ps.statSync(d).isFile()?{abs:d,root:vt.resolve(l.root),file:l.file,...l.repository?{repository:l.repository}:{}}:void 0},env:{...UT(e),...e.sutAuthEnv??{}},secrets:e.secretValues??[],...e.deadlineMs!==void 0?{deadlineMs:e.deadlineMs}:{},...e.signal?{signal:e.signal}:{}});Ps.rmSync(vt.join(e.outputsDir,oa),{force:!0});let c=await h3(e,a,u=>Rt(e).info(`[write] put back what recording the videos changed: ${u.join(", ")}`)).catch(u=>{let l=u instanceof Error?u.message:String(u);return Rt(e).warn(`[write] recording the browser tests' videos failed: ${l}`),me(e,oa)??bJ(t,e.outputsDir,"the recording broke before it finished")});return c?.skipped.length&&Rt(e).info(`[write] no video for ${c.skipped.map(u=>`${u.fileName} (${u.reason})`).join(", ")}`),{...s,...c?{"ui-videos":vt.relative(e.runDir,vt.join(e.outputsDir,oa))}:{}}}function UT(e){let t={};try{let n=cn(e)?Yxe(e):[],i=Hv(n.flatMap(({job:s})=>s.toolSteps),process.env,void 0,Gv(_d,e.inputs.repositoryPath));t={...n.length?ibt(e.outputsDir):{},...i.env}}catch{}let r=e.prepared?.appUrls?.env??{};try{return{...Xyt(qv(El(e.inputs.repositoryPath))),...t,...r,...Nm}}catch{return{...t,...r,...Nm}}}var tIt=new Set;function Yxe(e){let t=new Map;for(let{repo:r,run:n}of mSe(e)){let i=Rf(r),s=IJ(i,n.cwd,n.argv);if(s)t.set(`${r}\0${s.workflow}\0${s.job}`,{repo:r,job:s});else{let o=`[write] ${RJ(i,n.cwd,n.argv)}, so no CI job's services are started for it`,a=`${e.outputsDir}\0${r}\0${o}`;tIt.has(a)||(tIt.add(a),Rt(e).info(o))}}return[...t.values()]}function qUr(e){let t=Hv(Yxe(e).flatMap(({job:n})=>n.toolSteps),process.env,void 0,Gv(_d,e.inputs.repositoryPath)),r=t.missing.map(n=>`${n.tool} ${n.version}`);return[...t.notes.length?[`The CI test job's tool versions are first on PATH for you and for native-run (${t.notes.map(n=>n.replace(/^provisioning: /,"")).join("; ")}).`]:[],...r.length?[`The CI test job sets up ${r.join(", ")}, which this runner does not have: a test that needs it cannot run here, and native-run reports it as blocked by the environment. That is not a defect: change no code or test for it.`]:[]]}function zUr(e,t=_d){let r=new Map;for(let n of rM(e)){let i=er(e.inputs,n.repository)?.path,s=i?hs(i,n.file):void 0;i&&s&&r.set(vt.resolve(i,s.root),{repo:i,root:s.root})}return[...r].flatMap(([n,{repo:i,root:s}])=>{let o=bSe(i,n,t,[]);return o.wants?[`In ${s}, ${o.wants}, which this runner does not have. Its tests run on the runner's default Node where they install on it; where they do not, native-run reports them as blocked by the environment. That is not a defect: change no code or test for it.`]:o.env?.PATH?[`The tests in ${s} run on the Node they declare, first on this PATH: ${o.env.PATH.split(vt.delimiter)[0]}. Use it for your runs of them, as native-run does.`]:[]})}var dIt=Bce,GUr={name:dIt,verify(e,t){let{value:r}=ir(Ir,t.stdout,Ht(e),e.secretValues);if(!r)return{name:this.name,passed:!0};let n=Bn(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),i=b=>{let v=n(b);return yi(v)?xa(e.inputs,v.repository,v.rel):b},s=[{path:e.inputs.repositoryPath},...e.inputs.relatedRepos??[]],o=s.flatMap(({path:b,slug:v})=>{try{return(0,F3.execFileSync)("git",["-C",b,"diff","--name-only","--diff-filter=d","HEAD"],{encoding:"utf-8"}).split(`
834
+ `)[0],n=Lv(e.commit.prBody);return t===e.commit.message&&r===e.commit.prTitle&&n===e.commit.prBody?e:{...e,commit:{...e.commit,message:t,prTitle:r,prBody:n}}}function FUr(e,t){let{write:r,settled:n}=f3(PSe(t,me(e,"plan.json")));n.length&&Rt(e).warn(`[write] holds no test case \u2014 a support file, not a test: ${n.join(", ")}`);let i=Bn(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),s=j=>{let x=i(j);return yi(x)?{root:x.root,rel:x.rel,...x.repository?{repository:x.repository}:{}}:void 0},o=Je(process.env,UT(e)),a=Byt(Pyt(r,s,o,zw),o,zw);vUr(e,a);let c=a.roots.filter(j=>j.substituted.length);c.length&&Rt(e).warn(`[write] a browser build its Playwright declares was stood in for by another: ${c.map(j=>`${j.dir} (${j.substituted.join(", ")})`).join("; ")}`);let u=r,{write:l,settled:d}=TSt(u);d.length&&Rt(e).warn(`[write] failed before any check, with no application line \u2014 not a defect: ${d.join(", ")}`);let p;try{p=Kxe(e)}catch(j){Rt(e).warn(`[write] ${j instanceof Error?j.message:String(j)}`),p=new Map}let f=fIt(e,p),{write:h,settled:g}=DSt(l,f.texts,f.rules);g.length&&Rt(e).warn(`[write] quoted no requirement for what its failing check expects \u2014 not a defect: ${g.join(", ")}`);let y=LUr(BSe(cn(e)?wvt(h,kT(e).browserJourneys):h)),A=e.prepared?.dependencyBaseline??new Set,b=lIt(e,y),v=qxe(e,b).length?UCt(e,y,b,A):void 0,S=v?.write??y,C=zCt(Bxe(S,e.inputs.repositoryPath,e.inputs.relatedRepos??[],$xe(e))),T=C&&!S.report.nextSteps.includes(C)?{...S,report:{...S.report,nextSteps:[C,...S.report.nextSteps]}}:S;v?.reverted.length&&Rt(e).warn(`[write] undid the application dependency changes the gate refused: ${v.reverted.join(", ")}`),v?.leftOut.length&&Rt(e).warn(`[write] left out of delivery, as they need what was undone: ${v.leftOut.map(j=>`${j.file} (${j.reason})`).join("; ")}`),QUr(e,T);let R=zce(T,e.inputs.repositoryPath,e.inputs.relatedRepos??[],DJ(e,T)),D=qxe(e,R.finalize.dependencies.added);D.length&&(R.finalize.ready=!1,R.finalize.blockers=[...R.finalize.blockers,...D.slice(0,4)]);let $=aSe(e,t,e.prepared?.dependencyBaseline??new Set);$.length&&(R.finalize.ready=!1,R.finalize.blockers=[...R.finalize.blockers,...$.slice(0,4)]);let L=WSe(e,T);L.length&&(R.finalize.ready=!1,R.finalize.blockers=[...R.finalize.blockers,...L.slice(0,4)]),R.dropped.length&&Rt(e).warn(`[write] not on disk, left out of adapt.json: ${R.dropped.join(", ")}`),R.ambiguous.length&&Rt(e).warn(`[write] in both the repo under test and a related checkout, kept the repo under test's: ${R.ambiguous.join(", ")}`);let M={write:LT(e,"write.json",T),adapt:LT(e,"adapt.json",R.adapt),generate:LT(e,"generate.json",R.generate),"generate-ui":LT(e,"generate-ui.json",R.generateUi),finalize:LT(e,"finalize.json",R.finalize),deliverable:LT(e,Sve,Mwt(e))},K=qO(e);K.length&&Rt(e).info(`[write] line endings or final newline set as .editorconfig asks: ${K.join(", ")}`),sKe(e);let te=fu(e),B=j=>t.tests.filter(x=>x.file===j).flatMap(x=>[...x.isolatedRun?[x.isolatedRun.split(/\s+/)]:[],...x.run?[x.run.argv]:[]]),P=R.placed.map(j=>({...j,runs:B(j.written)})),N=jyt(e,"write",P,j=>te.some(x=>x.file===j.file&&(x.repository??"")===(j.repository??"")));return N&&Rt(e).warn(`[write] changed after its last run, so its result is not of the delivered test: ${N.files.map(j=>j.file).join(", ")}`),{artifacts:N?{...M,"stale-results":vt.relative(e.runDir,vt.join(e.outputsDir,DO))}:M,placed:R.placed}}function Lxe(e){return!cn(e)&&(!!e.inputs.appRunning||l2(me(e,"deploy.json")))}function eIt(e){let t;try{t=JSON.parse(SE(Ht(e))??"")}catch{return[]}let r=t?.tests;return Array.isArray(r)?r.flatMap(n=>{let i=w.array(wB).safeParse(n?.context);if(typeof n?.file!="string"||!n.file.trim()||!i.success||!i.data.length)return[];let s=Array.isArray(n.covers)?n.covers.filter(o=>typeof o=="string"):[];return[{...nu(e.inputs,n.file),covers:s,context:i.data}]}):[]}var Fxe=e=>({...UT(e),...e.sutAuthEnv??{}});function UUr(e,t){let r=zce(t,e.inputs.repositoryPath,e.inputs.relatedRepos??[]),n=new Map(t.tests.map(o=>[o.file,o])),i=r.placed.map(o=>({file:o.written,context:n.get(o.written)?.context})),s=new Map(r.placed.map(o=>[`${o.repository??""}\0${o.file}`,n.get(o.written)]));return{planned:KYe(e.inputs,i,r.adapt.items.map((o,a)=>({...o,from:r.placed[a].written}))),written:o=>s.get(`${o.repository??""}\0${o.file}`)}}function jUr(e,t){return e.exit===0&&t?.change==="unchanged"&&t.result.cases.length?t.result.cases.map(r=>({case:r.case,status:r.status==="skip"?"skip":"pass",...r.status!=="skip"&&r.runtimeTargets?{runtimeTargets:r.runtimeTargets}:{}})):e.exit===0?e.covers.map(r=>{let n=t?.result.cases.find(i=>i.case===r);return n?.status==="fail"?{case:r,status:"fail",...n.runtimeTargets?{runtimeTargets:n.runtimeTargets}:{}}:{case:r,status:"pass",...n?.status!=="skip"&&n?.runtimeTargets?{runtimeTargets:n.runtimeTargets}:{}}}):t&&t.result.exit!==0?t.result.cases.map(r=>({case:r.case,status:r.status,...r.status!=="skip"&&r.runtimeTargets?{runtimeTargets:r.runtimeTargets}:{}})):t&&t.change!=="unchanged"?t.result.cases.map(r=>({case:r.case,status:r.status})):[]}async function zxe(e,t){let r=FUr(e,t),n=r.placed,i=await Nz(e,{browserUsed:cB(e,"write"),browserWithheld:Wxe(e)}),s=i?{...r.artifacts,[EA]:vt.relative(e.runDir,vt.join(e.outputsDir,`${EA}.json`))}:r.artifacts;if(cn(e))return s;if(i){Rt(e).info("[write] no videos: a shared environment's tests are not run again until the data-safety guard covers that run");let u=bJ(t,e.outputsDir,"Testbot does not yet record video of tests against a shared environment");return{...s,...u?{"ui-videos":vt.relative(e.runDir,vt.join(e.outputsDir,oa))}:{}}}if(!e.prepared?.appUrls?.urls.length){Rt(e).info("[write] no videos: the run has no address of the app to give the tests");let u=bJ(t,e.outputsDir,"Testbot had no address of the app to give the test, so it was not run again, which could have reached another app");return{...s,...u?{"ui-videos":vt.relative(e.runDir,vt.join(e.outputsDir,oa))}:{}}}let o=new Map(n.map(u=>[u.written,u])),a=()=>_yt({write:t,outputsDir:e.outputsDir,resolve:u=>{let l=o.get(u),d=l&&vt.resolve(l.root,l.file);return l&&d&&Ps.existsSync(d)&&Ps.statSync(d).isFile()?{abs:d,root:vt.resolve(l.root),file:l.file,...l.repository?{repository:l.repository}:{}}:void 0},env:{...UT(e),...e.sutAuthEnv??{}},secrets:e.secretValues??[],...e.deadlineMs!==void 0?{deadlineMs:e.deadlineMs}:{},...e.signal?{signal:e.signal}:{}});Ps.rmSync(vt.join(e.outputsDir,oa),{force:!0});let c=await h3(e,a,u=>Rt(e).info(`[write] put back what recording the videos changed: ${u.join(", ")}`)).catch(u=>{let l=u instanceof Error?u.message:String(u);return Rt(e).warn(`[write] recording the browser tests' videos failed: ${l}`),me(e,oa)??bJ(t,e.outputsDir,"the recording broke before it finished")});return c?.skipped.length&&Rt(e).info(`[write] no video for ${c.skipped.map(u=>`${u.fileName} (${u.reason})`).join(", ")}`),{...s,...c?{"ui-videos":vt.relative(e.runDir,vt.join(e.outputsDir,oa))}:{}}}function UT(e){let t={};try{let n=cn(e)?Yxe(e):[],i=Hv(n.flatMap(({job:s})=>s.toolSteps),process.env,void 0,Gv(_d,e.inputs.repositoryPath));t={...n.length?ibt(e.outputsDir):{},...i.env}}catch{}let r=e.prepared?.appUrls?.env??{};try{return{...Xyt(qv(El(e.inputs.repositoryPath))),...t,...r,...Nm}}catch{return{...t,...r,...Nm}}}var tIt=new Set;function Yxe(e){let t=new Map;for(let{repo:r,run:n}of mSe(e)){let i=Rf(r),s=IJ(i,n.cwd,n.argv);if(s)t.set(`${r}\0${s.workflow}\0${s.job}`,{repo:r,job:s});else{let o=`[write] ${RJ(i,n.cwd,n.argv)}, so no CI job's services are started for it`,a=`${e.outputsDir}\0${r}\0${o}`;tIt.has(a)||(tIt.add(a),Rt(e).info(o))}}return[...t.values()]}function qUr(e){let t=Hv(Yxe(e).flatMap(({job:n})=>n.toolSteps),process.env,void 0,Gv(_d,e.inputs.repositoryPath)),r=t.missing.map(n=>`${n.tool} ${n.version}`);return[...t.notes.length?[`The CI test job's tool versions are first on PATH for you and for native-run (${t.notes.map(n=>n.replace(/^provisioning: /,"")).join("; ")}).`]:[],...r.length?[`The CI test job sets up ${r.join(", ")}, which this runner does not have: a test that needs it cannot run here, and native-run reports it as blocked by the environment. That is not a defect: change no code or test for it.`]:[]]}function zUr(e,t=_d){let r=new Map;for(let n of rM(e)){let i=er(e.inputs,n.repository)?.path,s=i?hs(i,n.file):void 0;i&&s&&r.set(vt.resolve(i,s.root),{repo:i,root:s.root})}return[...r].flatMap(([n,{repo:i,root:s}])=>{let o=bSe(i,n,t,[]);return o.wants?[`In ${s}, ${o.wants}, which this runner does not have. Its tests run on the runner's default Node where they install on it; where they do not, native-run reports them as blocked by the environment. That is not a defect: change no code or test for it.`]:o.env?.PATH?[`The tests in ${s} run on the Node they declare, first on this PATH: ${o.env.PATH.split(vt.delimiter)[0]}. Use it for your runs of them, as native-run does.`]:[]})}var dIt=Bce,GUr={name:dIt,verify(e,t){let{value:r}=ir(Ir,t.stdout,Ht(e),e.secretValues);if(!r)return{name:this.name,passed:!0};let n=Bn(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),i=b=>{let v=n(b);return yi(v)?xa(e.inputs,v.repository,v.rel):b},s=[{path:e.inputs.repositoryPath},...e.inputs.relatedRepos??[]],o=s.flatMap(({path:b,slug:v})=>{try{return(0,F3.execFileSync)("git",["-C",b,"diff","--name-only","--diff-filter=d","HEAD"],{encoding:"utf-8"}).split(`
835
835
  `).filter(S=>S&&aR(S)).map(S=>xa(e.inputs,v,S))}catch{return[]}}),a=r.tests.filter(b=>b.change!=="added"&&b.change!=="deleted"&&aR(b.file)).map(b=>({file:i(b.file),changed:b.change!=="unchanged",ran:b.result.exit!==null})),c=YKe(o,a);if(!cn(e)){let b=(Wi(e)?.maintenance??[]).filter(S=>S.action==="verify"||S.action==="update").map(S=>xa(e.inputs,S.repository,S.test)),v=r.tests.map(S=>({file:i(S.file),changed:!1,ran:S.result.exit!==null||S.change==="deleted"}));c.push(...KKe(b,v,r.notWritten.map(S=>i(S.case))))}let u=s.flatMap(({path:b,slug:v})=>{try{let S=new Set((0,F3.execFileSync)("git",["-C",b,"ls-files","--others","--exclude-standard"],{encoding:"utf-8"}).split(`
836
836
  `).filter(Boolean).map(C=>vt.posix.basename(C)));return(0,F3.execFileSync)("git",["-C",b,"diff","--name-only","--diff-filter=D","HEAD"],{encoding:"utf-8"}).split(`
837
837
  `).filter(C=>C&&aR(C)&&!S.has(vt.posix.basename(C))).map(C=>xa(e.inputs,v,C))}catch{return[]}});c.push(...ZKe(u,r.tests.filter(b=>b.change==="deleted").map(b=>i(b.file))));let l=b=>{let v=n(b);return yi(v)&&s2(v.root,v.rel)},d=r.tests.filter(b=>b.change==="updated"&&aR(b.file)&&(b.staleBecause||!l(b.file))||b.change==="deleted"&&aR(b.file)).map(b=>({...b,deleted:b.change==="deleted"}));if(!d.length)return Ps.writeFileSync(vt.join(e.outputsDir,oR),`[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/testbot-core",
3
- "version": "0.13.0-v3.362",
3
+ "version": "0.13.0-v3.363",
4
4
  "description": "Skyramp Testbot engine: AI-powered deterministic test generation, execution and maintenance",
5
5
  "main": "dist/main.js",
6
6
  "//files": "An explicit allowlist, never a glob. `dist/` is gitignored, so without this key npm's .gitignore fallback would publish a package with no engine in it; with a glob it would publish the sourcemaps, whose sourcesContent embeds every src/*.ts verbatim. dist/VERSION.json exists only in a release-engine.yml build.",