Skip to content
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

Removed Symbol Capture and Relaxed Test/Suite Name Matching for Better Compatibility #318

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

ajkolean
Copy link
Contributor

This pull request modifies the regex patterns used to capture output in Swift test runs. Specifically:

  1. Removed symbol capture:

    • Xcode and Swift Package Manager testing use different symbols to denote test statuses (e.g., ✔, ✖, etc.). Since these symbols can vary across environments, they were removed from the regex capture groups. The focus is now on capturing the essential parts of the test output (such as test names, results, and timings), ensuring better cross-environment compatibility.
  2. Relaxed test/suite name captures:

    • Tests and suites can be annotated with various names, including special characters and spaces. The regex patterns were updated to be more flexible, allowing for a broader range of valid names without failing to capture. This enables better parsing of outputs, regardless of how the test or suite names are formatted.

Changes:

  • Capture groups no longer include symbols. The symbol component was removed from all regex patterns to ensure consistent parsing across different environments like Xcode and Swift Package Manager, where test run symbols can differ.

  • Improved flexibility in capturing test and suite names. The regex patterns were updated to allow for names with special characters, spaces, or other variations.

For instance, this change was made to handle test runs more reliably:

Before:

static let regex = Regex(pattern: #"^(􀟈)\s*(Test run started\.)$"#)

After:

static let regex = Regex(pattern: #"^.\s+(Test run started\.)$"#)

Additionally, suite and test captures were relaxed. Tests/Suites can be annotated (@Test("This is a test name")) or not so we need to be flexible in capturing.

This update simplifies the handling of different environments and improves the accuracy of capturing test run details without depending on symbols that vary between environments.

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.27%. Comparing base (70864e5) to head (12ea7ac).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #318      +/-   ##
==========================================
+ Coverage   87.47%   88.27%   +0.80%     
==========================================
  Files          14       14              
  Lines        1948     1894      -54     
==========================================
- Hits         1704     1672      -32     
+ Misses        244      222      -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@cpisciotta cpisciotta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thanks for contributing this change 💪

@cpisciotta cpisciotta merged commit b63f185 into cpisciotta:main Oct 18, 2024
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants