Pitch: [SwiftPM] @testable build setting

As a user of @testable that actually doesn't hate it, I dont agree with placing this setting on the target itself.

I think testability is a function of how a target is used, not the target itself. By default all targets should not have testability enabled at all, but instead it should be opt-in as part of the dependency of a test target.

something like:

.target(name: "Foo"),
.testTarget(
  name: "FooTests",
  dependencies: [.target(name: "Foo", testable: true)]),

Obviously I'm biased, but I would like to see more of the idea pitched here incorporated into this change: [Pitch] Restrict testability to direct in-package source module dependencies of test targets

1 Like