# Pitch: \[SwiftPM\] @testable build setting

**URL:** <https://forums.swift.org/t/pitch-swiftpm-testable-build-setting/75084>\
**Category:** Pitches\
**Tags:** windows, packagemanager, testable\
**Created:** [October 1, 2024, 5:52pm UTC](https://forums.swift.org/t/pitch-swiftpm-testable-build-setting/75084 "2024-10-01T17:52:50Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![rauhul](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rauhul/32/35207_2.png) [@rauhul](https://forums.swift.org/u/rauhul)\
**Post date:** [October 1, 2024, 8:05pm UTC](https://forums.swift.org/t/pitch-swiftpm-testable-build-setting/75084/9 "2024-10-01T20:05:33Z")

</div>

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:

```swift
.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](https://forums.swift.org/t/pitch-restrict-testability-to-direct-in-package-source-module-dependencies-of-test-targets/73921)

---

_[View the full topic](https://forums.swift.org/t/pitch-swiftpm-testable-build-setting/75084)._
