MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / plannedBundleFiles

Function plannedBundleFiles

src/commands/test.ts:8137–8172  ·  view source on GitHub ↗

* Approximate the file list `writeBundle` would produce for the given * context, so dry-run can communicate it to the user without touching * disk. Mirrors `bundle.ts` write order (result/failure/code/video, * per-step screenshot+snapshot, meta last) at a coarse level — sidecar * evidence files

(ctx: CliFailureContext, failedOnly: boolean)

Source from the content-addressed store, hash-verified

8135 * to the failure window the bundle writer would keep.
8136 */
8137function plannedBundleFiles(ctx: CliFailureContext, failedOnly: boolean): string[] {
8138 const files: string[] = [];
8139 files.push('result.json');
8140 files.push('failure.json');
8141 files.push(`code.${pickCodeExtension(ctx.code.language, ctx.code.framework)}`);
8142 if (ctx.result.videoUrl) files.push('video.mp4');
8143
8144 const stepsToInclude = failedOnly
8145 ? ctx.steps.filter(s => {
8146 if (ctx.result.failedStepIndex === null) return false;
8147 const target = ctx.result.failedStepIndex;
8148 return s.stepIndex >= target - 1 && s.stepIndex <= target + 1;
8149 })
8150 : ctx.steps;
8151
8152 for (const step of stepsToInclude) {
8153 const prefix = stepFilenamePrefix(step.stepIndex);
8154 if (step.screenshotUrl) files.push(`steps/${prefix}-screenshot.png`);
8155 if (step.htmlSnapshotUrl) files.push(`steps/${prefix}-snapshot.html`);
8156 }
8157
8158 // Sidecar evidence (log/network/console): the count varies and depends
8159 // on the bundle writer's per-step grouping. Surface a rolled-up count
8160 // rather than predict per-file names — agents reading the dry-run see
8161 // there's "N more sidecar files" without us re-implementing the
8162 // grouping logic.
8163 const sidecar = ctx.failure.evidence.filter(
8164 e => e.kind !== 'screenshot' && e.kind !== 'snapshot',
8165 );
8166 if (sidecar.length > 0) {
8167 files.push(`steps/<stepIndex>-evidence.json (×${sidecar.length} sidecar entries)`);
8168 }
8169
8170 files.push('meta.json');
8171 return files;
8172}
8173
8174/**
8175 * L141 — detect server-side truncation: returns `true` when the string

Callers 1

runFailureGetFunction · 0.85

Calls 2

pickCodeExtensionFunction · 0.85
stepFilenamePrefixFunction · 0.85

Tested by

no test coverage detected