Skip to content

Commit b8607ae

Browse files
committed
feat(testing): Add default xcresult bundles for test tools
Create workspace-scoped result bundle paths for simulator, device, and macOS test commands when callers do not provide one. This makes test artifacts consistently available in text and structured output while preserving explicit result bundle paths. Extend workspace filesystem cleanup so managed result bundles are pruned safely without touching user-created bundles.
1 parent f896d7e commit b8607ae

43 files changed

Lines changed: 646 additions & 42 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Added
66

7+
- Added workspace-scoped default xcresult bundles for simulator, device, and macOS test tools so test artifacts are available in structured and text output even when callers do not pass `-resultBundlePath`.
78
- Added opt-in MCP server idle shutdown via `XCODEBUILDMCP_MCP_IDLE_TIMEOUT_MS`, allowing unused MCP server processes to gracefully exit after a configured idle period ([#394](https://github.com/getsentry/XcodeBuildMCP/issues/394)).
89

910
### Fixed

src/mcp/tools/device/__tests__/test_device.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ describe('test_device plugin', () => {
167167
'never',
168168
'-derivedDataPath',
169169
computeScopedDerivedDataPath('/path/to/project.xcodeproj'),
170+
'-resultBundlePath',
171+
expect.stringContaining('/result-bundles/test_device_'),
170172
'test',
171173
]);
172174
});

src/snapshot-tests/__fixtures__/cli/device/test--error-compiler.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ Compiler Errors (1):
1919
example_projects/iOS_Calculator/CalculatorApp/CalculatorApp.swift:33:42
2020

2121
❌ Test failed. (⏱️ <DURATION>)
22+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_device_<TIMESTAMP>_pid<PID>.xcresult
2223
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_device_<TIMESTAMP>_pid<PID>.log

src/snapshot-tests/__fixtures__/cli/device/test--failure.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ IntentionalFailureTests
5151
example_projects/iOS_Calculator/CalculatorAppTests/CalculatorAppTests.swift:286
5252

5353
❌ <FAIL_COUNT> tests failed, <PASS_COUNT> passed, <SKIP_COUNT> skipped (⏱️ <DURATION>)
54+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_device_<TIMESTAMP>_pid<PID>.xcresult
5455
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_device_<TIMESTAMP>_pid<PID>.log

src/snapshot-tests/__fixtures__/cli/device/test--success.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ Discovered 1 test(s):
1414
CalculatorAppTests/CalculatorAppTests/testAddition
1515
Running tests (1 completed, 0 failures, 0 skipped)
1616

17-
✅ 1 test passed, 0 skipped (⏱️ <DURATION>)
17+
✅ 1 test passed, 0 failed, 0 skipped (⏱️ <DURATION>)
18+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_device_<TIMESTAMP>_pid<PID>.xcresult
1819
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_device_<TIMESTAMP>_pid<PID>.log

src/snapshot-tests/__fixtures__/cli/macos/test--error-compiler.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ Compiler Errors (1):
2020
example_projects/macOS/MCPTest/MCPTestApp.swift:20:42
2121

2222
❌ Test failed. (⏱️ <DURATION>)
23+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_macos_<TIMESTAMP>_pid<PID>.xcresult
2324
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_macos_<TIMESTAMP>_pid<PID>.log

src/snapshot-tests/__fixtures__/cli/macos/test--error-wrong-scheme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ Errors (1):
1212
✗ The project named "MCPTest" does not contain a scheme named "NONEXISTENT". The "-list" option can be used to find the names of the schemes in the project.
1313

1414
❌ Test failed. (⏱️ <DURATION>)
15+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_macos_<TIMESTAMP>_pid<PID>.xcresult
1516
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_macos_<TIMESTAMP>_pid<PID>.log

src/snapshot-tests/__fixtures__/cli/macos/test--failure.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ MCPTestTests
2828
example_projects/macOS/MCPTestTests/MCPTestTests.swift:11
2929

3030
❌ <FAIL_COUNT> tests failed, <PASS_COUNT> passed, <SKIP_COUNT> skipped (⏱️ <DURATION>)
31+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_macos_<TIMESTAMP>_pid<PID>.xcresult
3132
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_macos_<TIMESTAMP>_pid<PID>.log

src/snapshot-tests/__fixtures__/cli/macos/test--success.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ Discovered 2 test(s):
1616
Running tests (1 completed, 0 failures, 0 skipped)
1717
Running tests (2 completed, 0 failures, 0 skipped)
1818

19-
✅ 2 tests passed, 0 skipped (⏱️ <DURATION>)
19+
✅ 2 tests passed, 0 failed, 0 skipped (⏱️ <DURATION>)
20+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_macos_<TIMESTAMP>_pid<PID>.xcresult
2021
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_macos_<TIMESTAMP>_pid<PID>.log

src/snapshot-tests/__fixtures__/cli/simulator/test--failure.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ IntentionalFailureTests
3636
example_projects/iOS_Calculator/CalculatorAppTests/CalculatorAppTests.swift:286
3737

3838
❌ <FAIL_COUNT> tests failed, <PASS_COUNT> passed, <SKIP_COUNT> skipped (⏱️ <DURATION>)
39+
├ Result Bundle: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/result-bundles/test_sim_<TIMESTAMP>_pid<PID>.xcresult
3940
└ Build Logs: <HOME>/Library/Developer/XcodeBuildMCP/workspaces/XcodeBuildMCP-<HASH>/logs/test_sim_<TIMESTAMP>_pid<PID>.log

0 commit comments

Comments
 (0)