@testrelic/playwright-analytics 2.3.6 → 2.3.7
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/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2524,6 +2524,7 @@ ${s}
|
|
|
2524
2524
|
`),await zt();let i=null;if(this.config.includeArtifacts&&this.runTimestamp)try{let l=path.dirname(this.config.outputPath);i=Jt(l,this.runTimestamp);let d=path.join(l,"artifact-manifest.json"),c=JSON.stringify(i),p=d+".tmp";fs$1.writeFileSync(p,c,"utf-8"),fs$1.renameSync(p,d);}catch{}if(this.activeReportMode==="streaming"&&this.streamingWriter)await this.finalizeStreamingReport(r,a,e,i);else {let l=this.buildTimeline(),d=new Map;for(let u of this.collectedTests){let g=d.get(u.testId);(!g||u.retry>g.retry)&&d.set(u.testId,u);}let c=Array.from(d.values()),p=er(c,l.length),f={schemaVersion:X,testRunId:this.testRunId,startedAt:this.startedAt,completedAt:r,totalDuration:a,summary:p,ci:D(),metadata:this.config.metadata,timeline:l,shardRunIds:null};this.writeReport(f),await Pe(f,this.config,i),He(p,this.config.outputPath,this.config.htmlReportPath,this.config.quiet),this.cloudClient&&await Qe(this.cloudClient,this.config.cloud,this.config.cloud?.uploadStrategy,this.testRunId,this.cloudRunId,f,r,a,p);}}catch{}}async finalizeStreamingReport(e,r,n,s){if(!this.streamingWriter)return;let{totalApiCalls:a,totalAssertions:o,totalNavigations:i,totalNetworkRequests:l,totalConsoleLogs:d,totalActionSteps:c}=this.summaryCounters;this.summaryCounters={total:0,passed:0,failed:0,flaky:0,skipped:0,timedOut:0,interrupted:0,totalApiCalls:a,totalAssertions:o,totalNavigations:i,totalNetworkRequests:l,totalConsoleLogs:d,totalActionSteps:c};let p=new Map,f=new Map;for(let y of this.testIndex){let T=`${y.filePath}::${y.titlePath.join(" > ")}`,v=p.get(T);(v===void 0||y.retryIndex>v)&&p.set(T,y.retryIndex);}let u=0;for(let y of this.testIndex){let T=`${y.filePath}::${y.titlePath.join(" > ")}`,v=p.get(T);if(y.isRetry=y.retryIndex<v,y.isRetry)continue;switch(u++,this.summaryCounters.total++,y.status){case "passed":this.summaryCounters.passed++;break;case "failed":this.summaryCounters.failed++;break;case "flaky":this.summaryCounters.flaky++;break;case "skipped":this.summaryCounters.skipped++;break;case "timedout":this.summaryCounters.timedOut++;break;default:this.summaryCounters.interrupted++;break}let k=f.get(y.filePath);switch(k||(k={filePath:y.filePath,total:0,passed:0,failed:0,flaky:0,skipped:0,timedOut:0},f.set(y.filePath,k)),k.total++,y.status){case "passed":k.passed++;break;case "failed":k.failed++;break;case "flaky":k.flaky++;break;case "skipped":k.skipped++;break;case "timedout":k.timedOut++;break}}let g=Array.from(f.values());this.streamingWriter.writeIndex(this.testIndex),this.streamingWriter.writeCompactIndex(this.testIndex);let h={reporterTotal:this.summaryCounters.total,indexTotal:u,playwrightStatus:n.status,isValid:this.summaryCounters.total===u};h.isValid||process.stderr.write(`[testrelic] WARNING: Summary count mismatch \u2014 reporter: ${h.reporterTotal}, index: ${h.indexTotal}
|
|
2525
2525
|
`);let m={total:this.summaryCounters.total,passed:this.summaryCounters.passed,failed:this.summaryCounters.failed,flaky:this.summaryCounters.flaky,skipped:this.summaryCounters.skipped,timedout:this.summaryCounters.timedOut,totalApiCalls:this.summaryCounters.totalApiCalls,uniqueApiUrls:0,apiCallsByMethod:{},apiCallsByStatusRange:{"2xx":0,"3xx":0,"4xx":0,"5xx":0,error:0},apiResponseTime:null,totalAssertions:this.summaryCounters.totalAssertions,passedAssertions:0,failedAssertions:0,totalNavigations:this.summaryCounters.totalNavigations,uniqueNavigationUrls:0,totalTimelineSteps:this.testIndex.length,totalActionSteps:this.summaryCounters.totalActionSteps,actionStepsByCategory:{}},b={testRunId:this.testRunId,startedAt:this.startedAt,completedAt:e,totalDuration:r,...this.summaryCounters,metadata:this.config.metadata,reportMode:"streaming",files:g,enrichedSummary:m,validation:h,writeErrors:this.streamingWriter.getWriteErrors()};this.streamingWriter.writeSummary(b);let C={schemaVersion:"2.0",generatedAt:new Date().toISOString(),reportMode:"streaming",summaryFile:"summary.json",indexFile:"index.json",testsDir:"tests",artifactsDir:"artifacts",testCount:this.testIndex.length,totalSizeBytes:this.streamingWriter.computeTotalSize()};this.streamingWriter.writeManifest(C),await Pe(this.buildStreamingReport(b,m,e,r),this.config,s),He(m,this.config.outputPath,this.config.htmlReportPath,this.config.quiet);let w=this.streamingWriter.getReportDir();if(process.stderr.write(`[testrelic] Streaming report written to ${w}
|
|
2526
2526
|
[testrelic] ${this.testIndex.length} test detail files on disk
|
|
2527
|
+
[testrelic] View report: npx testrelic serve ${w}
|
|
2527
2528
|
`),this.streamingWriter.getWriteErrors().length>0&&process.stderr.write(`[testrelic] WARNING: ${this.streamingWriter.getWriteErrors().length} write error(s) during streaming
|
|
2528
2529
|
`),this.streamingWriter.dispose(),this.cloudClient){let y=this.buildStreamingReport(b,m,e,r);await Qe(this.cloudClient,this.config.cloud,this.config.cloud?.uploadStrategy,this.testRunId,this.cloudRunId,y,e,r,m);}this.testIndex.length=0,this.collectedTests.length=0,this.streamingWriter=null,this.cloudClient=null;}buildStreamingReport(e,r,n,s){return {schemaVersion:X,testRunId:this.testRunId,startedAt:this.startedAt,completedAt:n,totalDuration:s,summary:r,ci:D(),metadata:this.config.metadata,timeline:[],shardRunIds:null}}printsToStdio(){return false}checkMemoryPressure(){try{let e=process.memoryUsage(),r=e.heapUsed/1024/1024;if(r<200)return;let n=e.heapUsed/e.heapTotal;n>.9&&this.activeReportMode==="embedded"?(process.stderr.write(`[testrelic] WARNING: High memory (${Math.round(r)} MB). Auto-switching to streaming mode.
|
|
2529
2530
|
`),this.switchToStreamingMode()):n>.8&&process.stderr.write(`[testrelic] WARNING: Memory pressure detected (${Math.round(r)} MB used).
|