MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / createTestDomainResult

Function createTestDomainResult

src/utils/xcodebuild-domain-results.ts:382–433  ·  view source on GitHub ↗
(options: {
  started: StartedPipeline;
  succeeded: boolean;
  target: BuildTarget;
  artifacts: TestResultArtifacts;
  fallbackErrorMessages?: readonly string[];
  includeDetectedXcresult?: boolean;
  preflight?: TestPreflightResult;
  request: BuildInvocationRequest;
})

Source from the content-addressed store, hash-verified

380}
381
382export function createTestDomainResult(options: {
383 started: StartedPipeline;
384 succeeded: boolean;
385 target: BuildTarget;
386 artifacts: TestResultArtifacts;
387 fallbackErrorMessages?: readonly string[];
388 includeDetectedXcresult?: boolean;
389 preflight?: TestPreflightResult;
390 request: BuildInvocationRequest;
391}): TestResultDomainResult {
392 const { durationMs, pipelineResult } = finalizePipelineResult(options);
393 const state = pipelineResult.state;
394 const testSelectionInfo = createTestSelectionInfo(options.preflight);
395 const testCases = state.testCaseResults.map((fragment) => ({
396 ...(fragment.suite !== undefined ? { suite: fragment.suite } : {}),
397 test: fragment.test,
398 status: fragment.status,
399 ...(fragment.durationMs !== undefined ? { durationMs: fragment.durationMs } : {}),
400 }));
401 const detectedXcresultPath =
402 options.includeDetectedXcresult === false || options.target === 'swift-package'
403 ? null
404 : options.started.pipeline.xcresultPath;
405 const providedXcresultPath =
406 'xcresultPath' in options.artifacts ? options.artifacts.xcresultPath : undefined;
407 const xcresultPath = providedXcresultPath ?? detectedXcresultPath;
408 const artifacts: TestResultArtifacts = {
409 ...options.artifacts,
410 ...(xcresultPath ? { xcresultPath } : {}),
411 };
412 const counts =
413 (xcresultPath ? extractTestSummaryCountsFromXcresult(xcresultPath) : null) ??
414 createStateTestCounts(state);
415 const result: TestResultDomainResult = {
416 kind: 'test-result',
417 request: options.request,
418 didError: !options.succeeded,
419 error: options.succeeded ? null : 'Tests failed',
420 summary: {
421 status: options.succeeded ? 'SUCCEEDED' : 'FAILED',
422 durationMs,
423 ...(counts ? { counts } : {}),
424 target: options.target,
425 },
426 artifacts,
427 ...(testSelectionInfo ? { tests: testSelectionInfo } : {}),
428 diagnostics: createTestDiagnostics(state, !options.succeeded, options.fallbackErrorMessages),
429 ...(testCases.length > 0 ? { testCases } : {}),
430 };
431
432 return result;
433}
434
435const XCODEBUILD_STRUCTURED_OUTPUT_SCHEMAS = {
436 'build-result': 'xcodebuildmcp.output.build-result',

Callers 4

createTestExecutorFunction · 0.90
createTestSimExecutorFunction · 0.90

Calls 5

finalizePipelineResultFunction · 0.85
createTestSelectionInfoFunction · 0.85
createStateTestCountsFunction · 0.85
createTestDiagnosticsFunction · 0.85

Tested by

no test coverage detected