-
-
Notifications
You must be signed in to change notification settings - Fork 193
Adding Unit Testing Tool for iOS #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for this will look at this later! |
|
Thank you for the project! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new iOS unit testing tool to run tests on iOS simulators and improve error reporting for failing tests.
- Extends the build response by adding a new rawOutput field.
- Adds type definitions for rawOutput.
- Implements and registers an iOS simulator test tool.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/utils/build-utils.ts | Added rawOutput property to the success response for build actions. |
| src/types/common.ts | Updated ToolResponse interface to include rawOutput. |
| src/tools/test_ios_simulator.ts | Implemented iOS simulator test tool with test failure parsing logic. |
| src/index.ts | Registered the new iOS simulator test tools. |
| text: `✅ ${platformOptions.logPrefix} ${buildAction} succeeded for scheme ${params.scheme}.`, | ||
| }, | ||
| ], | ||
| rawOutput: result.output + (result.error ? '\n' + result.error : ''), |
Copilot
AI
Apr 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider trimming trailing newlines from result.output before concatenation to avoid unintended extra newline characters in rawOutput.
| rawOutput: result.output + (result.error ? '\n' + result.error : ''), | |
| rawOutput: result.output.trimEnd() + (result.error ? '\n' + result.error : ''), |
| .split('\n') | ||
| .filter(l => /Test Case .* failed/.test(l)) | ||
| .map(l => { | ||
| const m = l.match(/Test Case '(.*)' failed \((.*)\)/)!; |
Copilot
AI
Apr 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a non-null assertion with the regex match may cause a runtime error if the log format ever changes; consider performing a safe check before destructuring the match result.
|
@joelklabo I've had a quick scan and it looks good, I need to take a deeper look later and will get back to you. I hope to have some time this evening. |
| registerTool( | ||
| server, | ||
| 'ios_simulator_test_by_name_workspace', | ||
| 'Run tests for an iOS app on a simulator specified by name using a workspace', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cameroncooke I think I should improve these if you have any tips. I see now that your other tools have much more detail here.
|
@joelklabo I've added some tests to the example projects, run the linter and formatted and removed some unused imported symbols. I think the
|
I think we can just look for the presence of an xcresultbundle when the I'm not sure when I'm going to have time to look into this, I'm afraid. You're welcome to take a sta,b otherwise I'll get on it as soon as I can so we can get this PR merged in. |
|
I've not forgotten about this been super busy recently and only have a few hours a day to focus on this. I will get this merged in. |
|
Yeah, same here, I agree with your comments. I'll take a stab at it if I can find time today |
|
Just wanted to +1 this! Would love to see this added soon. Thanks for the great tools already, they work really well. Would love to help in any way I can. |
|
also waiting for this feature |
|
Thanks for your contribution, this has now been implemented, so I am closing this PR. Thanks again! |
|
Thanks for implementing it @cameroncooke ! |


Adding tools to run unit tests on iOS.
The error reporting could be improved but it successfully indicates which test fails when run.