skeptic-cli 0.2.0 → 0.2.1

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/worker.mjs CHANGED
@@ -707,7 +707,7 @@ ${u}
707
707
  __actionLog: actionLog,
708
708
  };
709
709
  })();
710
- `;var $t=u=>{parentPort?.postMessage(u);},cb=async u=>{let s=bg(u);try{await tsImport(pathToFileURL(u).href,import.meta.url);}finally{wg();}return s},A8=u=>{let s=u.tests.map(f=>({id:f.id,file:f.file,ordinal:f.ordinal,name:f.name,skip:f.skip,only:f.only,use:{...u.fileUse,...f.use}}));return {file:u.file,fileUse:{...u.fileUse},hookCount:{beforeEach:u.beforeEach.length,afterEach:u.afterEach.length},tests:s}},C8=async u=>{try{let s=await cb(u),f=A8(s);parentPort?.postMessage({type:"manifest",manifest:f});}catch(s){parentPort?.postMessage({type:"error",error:{message:s instanceof Error?s.message:String(s),stack:s instanceof Error?s.stack??"":""}});}finally{process.exit(0);}},R8=u=>u.replace(/[^a-zA-Z0-9_-]/g,"_"),T8=async(u,s,f,d)=>{let m=performance.now(),v=R8(u.name||`test-${u.ordinal}`),b=pa__default.join(f.outputDir,`${v}-${u.ordinal}`);await mkdir(b,{recursive:true});let x={...s.fileUse,...u.use},E=x.viewport??f.viewport??{width:1280,height:720},A=x.timeout??f.timeout,S=x.hardTimeout??(x.timeout!==void 0?x.timeout:f.hardTimeout),k=f.videoSize??x.videoSize??E,I=await d.newContext({viewport:E,...f.video?{recordVideo:{dir:b,size:k}}:{}});if(f.trace&&await I.tracing.start({screenshots:true,snapshots:true,sources:false}),f.video)try{await I.addInitScript({content:Xy});}catch(ge){$t({type:"log",level:"warn",message:`[skeptic] cursor overlay init script failed: ${ge instanceof Error?ge.message:String(ge)}`});}I.setDefaultTimeout(A);let $=await I.newPage(),G=x.collectors??[],V=new Set;f.observability.forceAll&&(V.add("performance"),V.add("network"),V.add("console"),V.add("accessibility"));for(let ge of G)V.add(ge);let te={collectors:[...V],networkCaptureLimit:f.observability.networkCaptureLimit,duplicateWindowMs:f.observability.duplicateWindowMs,accessibilityDualEngine:f.observability.accessibilityDualEngine,accessibilityHtmlSnippetLimit:f.observability.accessibilityHtmlSnippetLimit,consoleCaptureLimit:f.observability.consoleCaptureLimit,consoleRedaction:f.observability.consoleRedaction,autoAccessibilityAudit:f.observability.autoAccessibilityAudit,accessibilityStandard:f.observability.accessibilityStandard,accessibilityMaxRulesPerImpact:f.observability.accessibilityMaxRulesPerImpact},re=Wy({required:V,configured:[],config:te}),pe={fullPageScreenshots:f.artifact.fullPageScreenshots,visualSettle:f.observability.forceAll?Py:cs,blankFrameDetection:f.artifact.blankFrameDetection,writeSidecars:f.artifact.writeSidecars},Pe=new ds($,f.baseUrl??x.url??"",b,pa__default.dirname(s.file),void 0,void 0,A,re,pe);for(let ge of re)try{await ge.attach($,Pe);}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] collector ${ge.name} attach failed: ${Ee instanceof Error?Ee.message:String(Ee)}`}),Pe.collectors.delete(ge.name);}let Ie=[],yr=Lv($,Pe,{onAction:ge=>{ge.status==="completed"?Ie.push({command:ge.label,args:{},status:"passed",duration_ms:ge.durationMs??0}):ge.status==="failed"&&Ie.push({command:ge.label,args:{},status:"failed",duration_ms:ge.durationMs??0,error:ge.error}),$t({type:"test:action",testId:u.id,label:ge.label,status:ge.status,...ge.durationMs!==void 0?{durationMs:ge.durationMs}:{},...ge.error!==void 0?{error:ge.error}:{}});},enableCursorProxy:f.video}),at={name:u.name,file:s.file,testIndex:u.ordinal,status:"passed",duration_ms:0,steps:Ie,artifacts:{},...f.shardId!==void 0?{shardId:f.shardId}:{}},sn,_s=new Promise(ge=>{sn=setTimeout(()=>{Pe.abortReason=`test timeout exceeded (${S}ms)`,$.context().close().catch(()=>{}),ge("hard-timeout");},S);}),zr;try{for(let Ee of s.beforeEach)await yr.runAction("beforeEach",()=>Promise.resolve(Ee.fn(yr)));await Promise.race([Promise.resolve(u.skip?void 0:s.tests[u.ordinal]?.fn(yr)).then(()=>"ok"),_s])==="hard-timeout"&&(at.status="failed",zr=Pe.abortReason??`test timeout exceeded (${S}ms)`);}catch(ge){at.status="failed",zr=ge instanceof Error?ge.message:String(ge);}finally{sn&&clearTimeout(sn);}Pe.inTeardown=true;try{for(let ge of s.afterEach)try{await yr.runAction("afterEach",()=>Promise.resolve(ge.fn(yr)));}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] afterEach failed: ${Ee instanceof Error?Ee.message:String(Ee)}`});}}finally{Pe.inTeardown=false;}let ln=Pe.collectors.get("accessibility");if(ln instanceof on&&te.autoAccessibilityAudit&&Pe.abortReason===null&&!$.isClosed()&&!(await ln.snapshot()!==void 0))try{await ln.audit({standard:te.accessibilityStandard});}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] auto a11y audit failed: ${Ee instanceof Error?Ee.message:String(Ee)}`});}let nr={};for(let ge of Pe.collectors.values())try{let Ee=await ge.snapshot();Ee!=null&&(nr[ge.name]=Ee);}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] collector ${ge.name} snapshot failed: ${Ee instanceof Error?Ee.message:String(Ee)}`});}for(let ge of Pe.collectors.values())try{await ge.detach();}catch{}if(f.trace)try{let ge=pa__default.join(b,`${v}.trace.zip`);await I.tracing.stop({path:ge}),at.artifacts.trace=ge;}catch{}if(Object.keys(nr).length>0&&(at.metrics=nr),Pe.screenshots.length>0&&(at.artifacts.screenshots=[...Pe.screenshots]),pe.writeSidecars&&Object.keys(nr).length>0&&await Ky({testDir:b,metrics:nr,artifacts:at.artifacts,observabilityConfig:te}),f.video)try{let ge=$.video();if(ge){let Ee=pa__default.join(b,`${v}.webm`);await $.close().catch(()=>{}),await ge.saveAs(Ee),at.artifacts.video={path:Ee,width:k.width,height:k.height};}}catch(ge){$t({type:"log",level:"warn",message:`[skeptic] video save failed: ${ge instanceof Error?ge.message:String(ge)}`});}return await I.close().catch(()=>{}),at.duration_ms=Math.round(performance.now()-m),zr?(at.status="failed",at.steps.push({command:"test",args:{name:u.name},status:"failed",duration_ms:at.duration_ms,error:zr})):u.skip?(at.status="passed",at.steps.push({command:"test",args:{name:u.name},status:"skipped",duration_ms:0})):at.steps.push({command:"test",args:{name:u.name},status:"passed",duration_ms:at.duration_ms}),at},S8=async u=>{let s=null;try{s=await cb(u.file);}catch(E){$t({type:"fatal",message:E instanceof Error?E.message:String(E),...E instanceof Error&&E.stack?{stack:E.stack}:{}}),process.exit(0);return}let f=new Set(u.allowlist),d=[],m;try{m=await ps();}catch(E){$t({type:"fatal",message:`playwright load failed: ${E instanceof Error?E.message:String(E)}`}),process.exit(0);return}let v=m[u.config.browserEngine],b,x=null;try{if(u.config.noDaemon)b=await v.launch({headless:!u.config.headed});else {let{connectDaemon:E}=await Promise.resolve().then(()=>(ub(),lb)),A=await E({engine:u.config.browserEngine,headed:u.config.headed,cliVersion:"0.2.0",...typeof u.config.daemonIdleTimeoutSeconds=="number"?{idleTimeoutSeconds:u.config.daemonIdleTimeoutSeconds}:{}});b=A.browser,x=A.disconnect;}}catch(E){$t({type:"fatal",message:`browser launch failed: ${E instanceof Error?E.message:String(E)}`}),process.exit(0);return}try{for(let E of s.tests){if(!f.has(E.id))continue;$t({type:"test:start",testId:E.id,ordinal:E.ordinal,name:E.name,file:s.file,...u.config.shardId!==void 0?{shardId:u.config.shardId}:{}});let A;try{A=await T8(E,s,u.config,b);}catch(S){A={name:E.name,file:s.file,status:"failed",duration_ms:0,steps:[{command:"test",args:{name:E.name},status:"error",duration_ms:0,error:S instanceof Error?S.message:String(S)}],artifacts:{},...u.config.shardId!==void 0?{shardId:u.config.shardId}:{}};}d.push(E.id),$t({type:"test:complete",testId:E.id,ordinal:E.ordinal,result:A});}}finally{x?await x().catch(()=>{}):await b.close().catch(()=>{}),$t({type:"file:complete",file:s.file,finished:d}),process.exit(0);}},k8=async u=>{await S8(u);};!isMainThread&&parentPort&&(workerData?.mode==="discover"&&typeof workerData?.file=="string"?C8(workerData.file):(parentPort.on("message",u=>{u.type==="start"&&k8(u);}),$t({type:"ready"})));/*! Bundled license information:
710
+ `;var $t=u=>{parentPort?.postMessage(u);},cb=async u=>{let s=bg(u);try{await tsImport(pathToFileURL(u).href,import.meta.url);}finally{wg();}return s},A8=u=>{let s=u.tests.map(f=>({id:f.id,file:f.file,ordinal:f.ordinal,name:f.name,skip:f.skip,only:f.only,use:{...u.fileUse,...f.use}}));return {file:u.file,fileUse:{...u.fileUse},hookCount:{beforeEach:u.beforeEach.length,afterEach:u.afterEach.length},tests:s}},C8=async u=>{try{let s=await cb(u),f=A8(s);parentPort?.postMessage({type:"manifest",manifest:f});}catch(s){parentPort?.postMessage({type:"error",error:{message:s instanceof Error?s.message:String(s),stack:s instanceof Error?s.stack??"":""}});}finally{process.exit(0);}},R8=u=>u.replace(/[^a-zA-Z0-9_-]/g,"_"),T8=async(u,s,f,d)=>{let m=performance.now(),v=R8(u.name||`test-${u.ordinal}`),b=pa__default.join(f.outputDir,`${v}-${u.ordinal}`);await mkdir(b,{recursive:true});let x={...s.fileUse,...u.use},E=x.viewport??f.viewport??{width:1280,height:720},A=x.timeout??f.timeout,S=x.hardTimeout??(x.timeout!==void 0?x.timeout:f.hardTimeout),k=f.videoSize??x.videoSize??E,I=await d.newContext({viewport:E,...f.video?{recordVideo:{dir:b,size:k}}:{}});if(f.trace&&await I.tracing.start({screenshots:true,snapshots:true,sources:false}),f.video)try{await I.addInitScript({content:Xy});}catch(ge){$t({type:"log",level:"warn",message:`[skeptic] cursor overlay init script failed: ${ge instanceof Error?ge.message:String(ge)}`});}I.setDefaultTimeout(A);let $=await I.newPage(),G=x.collectors??[],V=new Set;f.observability.forceAll&&(V.add("performance"),V.add("network"),V.add("console"),V.add("accessibility"));for(let ge of G)V.add(ge);let te={collectors:[...V],networkCaptureLimit:f.observability.networkCaptureLimit,duplicateWindowMs:f.observability.duplicateWindowMs,accessibilityDualEngine:f.observability.accessibilityDualEngine,accessibilityHtmlSnippetLimit:f.observability.accessibilityHtmlSnippetLimit,consoleCaptureLimit:f.observability.consoleCaptureLimit,consoleRedaction:f.observability.consoleRedaction,autoAccessibilityAudit:f.observability.autoAccessibilityAudit,accessibilityStandard:f.observability.accessibilityStandard,accessibilityMaxRulesPerImpact:f.observability.accessibilityMaxRulesPerImpact},re=Wy({required:V,configured:[],config:te}),pe={fullPageScreenshots:f.artifact.fullPageScreenshots,visualSettle:f.observability.forceAll?Py:cs,blankFrameDetection:f.artifact.blankFrameDetection,writeSidecars:f.artifact.writeSidecars},Pe=new ds($,f.baseUrl??x.url??"",b,pa__default.dirname(s.file),void 0,void 0,A,re,pe);for(let ge of re)try{await ge.attach($,Pe);}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] collector ${ge.name} attach failed: ${Ee instanceof Error?Ee.message:String(Ee)}`}),Pe.collectors.delete(ge.name);}let Ie=[],yr=Lv($,Pe,{onAction:ge=>{ge.status==="completed"?Ie.push({command:ge.label,args:{},status:"passed",duration_ms:ge.durationMs??0}):ge.status==="failed"&&Ie.push({command:ge.label,args:{},status:"failed",duration_ms:ge.durationMs??0,error:ge.error}),$t({type:"test:action",testId:u.id,label:ge.label,status:ge.status,...ge.durationMs!==void 0?{durationMs:ge.durationMs}:{},...ge.error!==void 0?{error:ge.error}:{}});},enableCursorProxy:f.video}),at={name:u.name,file:s.file,testIndex:u.ordinal,status:"passed",duration_ms:0,steps:Ie,artifacts:{},...f.shardId!==void 0?{shardId:f.shardId}:{}},sn,_s=new Promise(ge=>{sn=setTimeout(()=>{Pe.abortReason=`test timeout exceeded (${S}ms)`,$.context().close().catch(()=>{}),ge("hard-timeout");},S);}),zr;try{for(let Ee of s.beforeEach)await yr.runAction("beforeEach",()=>Promise.resolve(Ee.fn(yr)));await Promise.race([Promise.resolve(u.skip?void 0:s.tests[u.ordinal]?.fn(yr)).then(()=>"ok"),_s])==="hard-timeout"&&(at.status="failed",zr=Pe.abortReason??`test timeout exceeded (${S}ms)`);}catch(ge){at.status="failed",zr=ge instanceof Error?ge.message:String(ge);}finally{sn&&clearTimeout(sn);}Pe.inTeardown=true;try{for(let ge of s.afterEach)try{await yr.runAction("afterEach",()=>Promise.resolve(ge.fn(yr)));}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] afterEach failed: ${Ee instanceof Error?Ee.message:String(Ee)}`});}}finally{Pe.inTeardown=false;}let ln=Pe.collectors.get("accessibility");if(ln instanceof on&&te.autoAccessibilityAudit&&Pe.abortReason===null&&!$.isClosed()&&!(await ln.snapshot()!==void 0))try{await ln.audit({standard:te.accessibilityStandard});}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] auto a11y audit failed: ${Ee instanceof Error?Ee.message:String(Ee)}`});}let nr={};for(let ge of Pe.collectors.values())try{let Ee=await ge.snapshot();Ee!=null&&(nr[ge.name]=Ee);}catch(Ee){$t({type:"log",level:"warn",message:`[skeptic] collector ${ge.name} snapshot failed: ${Ee instanceof Error?Ee.message:String(Ee)}`});}for(let ge of Pe.collectors.values())try{await ge.detach();}catch{}if(f.trace)try{let ge=pa__default.join(b,`${v}.trace.zip`);await I.tracing.stop({path:ge}),at.artifacts.trace=ge;}catch{}if(Object.keys(nr).length>0&&(at.metrics=nr),Pe.screenshots.length>0&&(at.artifacts.screenshots=[...Pe.screenshots]),pe.writeSidecars&&Object.keys(nr).length>0&&await Ky({testDir:b,metrics:nr,artifacts:at.artifacts,observabilityConfig:te}),f.video)try{let ge=$.video();if(ge){let Ee=pa__default.join(b,`${v}.webm`);await $.close().catch(()=>{}),await ge.saveAs(Ee),at.artifacts.video={path:Ee,width:k.width,height:k.height};}}catch(ge){$t({type:"log",level:"warn",message:`[skeptic] video save failed: ${ge instanceof Error?ge.message:String(ge)}`});}return await I.close().catch(()=>{}),at.duration_ms=Math.round(performance.now()-m),zr?(at.status="failed",at.steps.push({command:"test",args:{name:u.name},status:"failed",duration_ms:at.duration_ms,error:zr})):u.skip?(at.status="passed",at.steps.push({command:"test",args:{name:u.name},status:"skipped",duration_ms:0})):at.steps.push({command:"test",args:{name:u.name},status:"passed",duration_ms:at.duration_ms}),at},S8=async u=>{let s=null;try{s=await cb(u.file);}catch(E){$t({type:"fatal",message:E instanceof Error?E.message:String(E),...E instanceof Error&&E.stack?{stack:E.stack}:{}}),process.exit(0);return}let f=new Set(u.allowlist),d=[],m;try{m=await ps();}catch(E){$t({type:"fatal",message:`playwright load failed: ${E instanceof Error?E.message:String(E)}`}),process.exit(0);return}let v=m[u.config.browserEngine],b,x=null;try{if(u.config.noDaemon)b=await v.launch({headless:!u.config.headed});else {let{connectDaemon:E}=await Promise.resolve().then(()=>(ub(),lb)),A=await E({engine:u.config.browserEngine,headed:u.config.headed,cliVersion:"0.2.1",...typeof u.config.daemonIdleTimeoutSeconds=="number"?{idleTimeoutSeconds:u.config.daemonIdleTimeoutSeconds}:{}});b=A.browser,x=A.disconnect;}}catch(E){$t({type:"fatal",message:`browser launch failed: ${E instanceof Error?E.message:String(E)}`}),process.exit(0);return}try{for(let E of s.tests){if(!f.has(E.id))continue;$t({type:"test:start",testId:E.id,ordinal:E.ordinal,name:E.name,file:s.file,...u.config.shardId!==void 0?{shardId:u.config.shardId}:{}});let A;try{A=await T8(E,s,u.config,b);}catch(S){A={name:E.name,file:s.file,status:"failed",duration_ms:0,steps:[{command:"test",args:{name:E.name},status:"error",duration_ms:0,error:S instanceof Error?S.message:String(S)}],artifacts:{},...u.config.shardId!==void 0?{shardId:u.config.shardId}:{}};}d.push(E.id),$t({type:"test:complete",testId:E.id,ordinal:E.ordinal,result:A});}}finally{x?await x().catch(()=>{}):await b.close().catch(()=>{}),$t({type:"file:complete",file:s.file,finished:d}),process.exit(0);}},k8=async u=>{await S8(u);};!isMainThread&&parentPort&&(workerData?.mode==="discover"&&typeof workerData?.file=="string"?C8(workerData.file):(parentPort.on("message",u=>{u.type==="start"&&k8(u);}),$t({type:"ready"})));/*! Bundled license information:
711
711
 
712
712
  axe-core/axe.js:
713
713
  (*! axe v4.11.3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skeptic-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "CLI E2E testing for AI agents — TypeScript test runner with AI assertions, observability, and snapshot-based discovery",
5
5
  "type": "module",
6
6
  "bin": {