Transitive "build for testing" / "enable testability" for local packages?

Hello, I would like to have the "build for testing" / "enable testability" flag be propagated to the local packages dependencies of my app when I build the unit tests target.

In the end, I'd like to have @testable import MyLocalPackage next to @testable import MyApp. Right now if I try to do that, Swift tells me that "MyLocalPackage was not build for testing".

Is that possible ? Could I just enable testability for all local packages in debug configuration in their Package.swift, or is it a compiler flag?

2 Likes

Wondering if you ever found a solution? Or if anyone knows a 2024 (Xcode 16?) solution?

I am facing the same issue trying to include a local package's test target/plan into the main app's test plan.

No matter how I seem to include the local package's test target into the main apps scheme/plan etc., I always get the dreaded "Module '…' was not compiled for testing". Opening the local package standalone and running the tests works fine, I just can't seem to integrate them to run in conjunction with the main app's tests.