Skip to content

Swift Testing migration policy: use XCTest interop, port KeyPathTestCase guards to a trait #918

Description

@malpern

Post-1.0. Not for the 1.0 launch. From the WWDC 2026 review — see docs/wwdc-2026-macos-27-opportunities.md (PR #911), opportunity #7.

Why

The codebase is ~294 XCTest files vs ~48 Swift Testing files. WWDC26 shipped Swift Testing ↔ XCTest interoperability (call either framework's APIs from a test body in the other), which removes the main migration blocker: shared safety helpers like KeyPathTestCase (the no-real-pgrep deadlock guard) couldn't straddle frameworks safely.

Plan — change the policy, not the codebase

This is explicitly not a 294-file migration project:

  1. Port the KeyPathTestCase safety guards (pgrep deadlock prevention, fast-test rules) to a Swift Testing trait/fixture.
  2. Policy: new tests use Swift Testing; convert existing files opportunistically when touched.
  3. Use parameterized @Test cases for layout/keymap matrices (good fit for KeyPathLayoutTracerTests-style suites).
  4. Keep the <5s total suite-speed rule from CLAUDE.md.

Requires the Xcode 27 toolchain (see toolchain upgrade issue).

https://claude.ai/code/session_01Nsiqm39oCwHkbrHytefnGM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions