MCPcopy
hub / github.com/callstack/agent-device / writeFailureArtifacts

Function writeFailureArtifacts

test/integration/smoke-web-platform.test.ts:301–328  ·  view source on GitHub ↗
(
  context: WebSmokeContext,
  step: string,
  args: string[],
  result: CliJsonResult,
  message: string,
  assertionDetail?: string,
)

Source from the content-addressed store, hash-verified

299}
300
301function writeFailureArtifacts(
302 context: WebSmokeContext,
303 step: string,
304 args: string[],
305 result: CliJsonResult,
306 message: string,
307 assertionDetail?: string,
308): void {
309 writeFileSync(path.join(context.artifactDir, 'failed-step.txt'), message);
310 writeFileSync(
311 path.join(context.artifactDir, 'failed-step.json'),
312 JSON.stringify(
313 { step, command: `agent-device ${args.join(' ')}`, assertionDetail, result },
314 null,
315 2,
316 ),
317 );
318 writeFileSync(
319 path.join(context.artifactDir, 'step-history.json'),
320 JSON.stringify(context.stepHistory, null, 2),
321 );
322 if (context.lastSnapshot) {
323 writeFileSync(
324 path.join(context.artifactDir, 'last-snapshot.json'),
325 JSON.stringify(context.lastSnapshot, null, 2),
326 );
327 }
328}
329
330function formatLastSnapshotContext(context: WebSmokeContext): string {
331 const nodes = context.lastSnapshot?.data?.nodes;

Callers 1

failWithContextFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected