Skip to content

AEGIS-10939 clarify scope of legacy XCTesting#35

Merged
mlink merged 1 commit into
mainfrom
AEGIS-10939-clarify-scope-of-legacy-XCTesting
May 11, 2026
Merged

AEGIS-10939 clarify scope of legacy XCTesting#35
mlink merged 1 commit into
mainfrom
AEGIS-10939-clarify-scope-of-legacy-XCTesting

Conversation

@mlink
Copy link
Copy Markdown
Contributor

@mlink mlink commented May 11, 2026

This pull request introduces improvements to the mocking infrastructure for subprocesses, making it easier and safer to set up and tear down mocks in both Swift Testing and XCTest environments. The main changes include a new static method for setting up mock builders, improved reset behavior, an updated import strategy for internal APIs, and a deprecation/rename of a key test trait. Documentation has also been updated to reflect these changes.

Mocking Infrastructure Improvements

  • Added a setupMockBuilder() static method to SubprocessMockObject (and thus to Shell and Subprocess) to simplify and standardize the setup of mock dependency builders, replacing direct assignment to SubprocessDependencyBuilder.shared. (Sources/SubprocessMocks/MockSubprocessDependencyBuilder.swift, CHANGELOG.md) [1] [2]
  • Modified SubprocessMockObject.reset() to also restore SubprocessDependencyBuilder.shared to a real instance, so manual teardown in XCTest is no longer required. (Sources/SubprocessMocks/MockSubprocessDependencyBuilder.swift, CHANGELOG.md) [1] [2]

Testing Trait Updates

  • Deprecated the .subprocessTesting trait and introduced .subprocess as the new name for use with Swift Testing, updating documentation and code accordingly. (Sources/SubprocessTesting/SubprocessTesting.swift, README.md, CHANGELOG.md) [1] [2] [3] [4] [5]

Internal API Access for Mocks

  • Changed SubprocessMocks to import Subprocess with @testable to expose internal APIs required for mocking. (Sources/SubprocessMocks/MockSubprocessDependencyBuilder.swift, CHANGELOG.md) [1] [2]

Documentation Updates

  • Updated the README.md to reflect the new .subprocess trait and added a section on using the new setup/reset methods in XCTest. (README.md) [1] [2] [3] [4]

Test Suite Refactoring

  • Refactored test setup and teardown in unit and system tests to use the new setupMockBuilder() and reset() methods instead of directly assigning to SubprocessDependencyBuilder.shared. (Tests/UnitTests/ShellTests.swift, Tests/UnitTests/SubprocessTests.swift, Tests/SystemTests/ShellSystemTests.swift, Tests/SystemTests/SubprocessSystemTests.swift) [1] [2] [3] [4]

@mlink mlink merged commit d0dadcc into main May 11, 2026
4 checks passed
@mlink mlink deleted the AEGIS-10939-clarify-scope-of-legacy-XCTesting branch May 11, 2026 19:58
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.

3 participants