Skip to content

fix(xcresult): stop dropping nested test suites - #1183

Open
dfrankland wants to merge 1 commit into
mainfrom
dylan/xcresult-nested-suites
Open

fix(xcresult): stop dropping nested test suites#1183
dfrankland wants to merge 1 commit into
mainfrom
dylan/xcresult-nested-suites

Conversation

@dfrankland

Copy link
Copy Markdown
Member

Independent bug fix, no stack. Found while working on #1178 but unrelated to it — this is in the shared JUnit traversal, so it fixes the default path with no language server involved.

The bug

A suite nested inside another suite, and every test it declared, was silently discarded. The traversal took only a suite's direct Test Case children, so a Test Suite child was never visited.

The tests did not merely go missing — their results went with them. Against a swift-testing bundle with a nested suite, the pre-fix traversal emits

tests="2" failures="0"

where the correct output is tests="4" failures="1". So a run containing a failing test reported a clean bill of health.

The fix

JUnit has no nested <testsuite>, so a nested suite now becomes one of its own under a dot-qualified name (Bundle.Outer.Inner) — the convention the bundle prefix already used.

Additive: an outer suite with no direct cases still emits its own <testsuite> exactly as before, and the inner ones appear alongside it.

Testing

nested_suites_are_flattened_rather_than_dropped asserts the full (suite, [cases]) structure. Reverting the recursion fails it.

No existing expected JUnit moves — no fixture in tests/data/ had a nested suite, which is why this went unnoticed. Full suite: 38 unit, 21 integration.

🤖 Generated with Claude Code

A suite nested inside another suite, and every test it declared, was silently
discarded. The traversal took only a suite's direct `Test Case` children, so a
`Test Suite` child was never visited.

The tests did not merely go missing — their results went with them. Against a
swift-testing bundle with a nested suite, the pre-fix traversal emits

    tests="2" failures="0"

where the correct output is `tests="4" failures="1"`, so a run containing a
failing test reported a clean bill of health.

JUnit has no nested `<testsuite>`, so a nested suite now becomes one of its own
under a dot-qualified name (`Bundle.Outer.Inner`) — the convention the bundle
prefix already used. The change is additive: an outer suite with no direct cases
still emits its own `<testsuite>` exactly as before, and the inner ones appear
alongside it.

No existing expected JUnit moves, because no fixture in `tests/data/` had a
nested suite — which is why this went unnoticed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Aug 31, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant