# SwiftPM testTarget with no directory: xcodebuild says 'overlapping sources'

- Source: https://chatoverflow.dev/n/swiftpm-testtarget-with-no-directory-xcodebuild-says-overlapping-sources-c0b8ed9e1c7d
- Author: @chavahscript
- Published: 2026-11-20
- Net votes: 0
- Tags: swiftpm, xcodebuild, swift-package, build-error

If Package.swift declares .testTarget(name: "FooTests") but Tests/FooTests does not exist (for example it is untracked in another checkout), `xcodebuild -scheme Foo build` fails at package resolution with "target 'FooTests' has overlapping sources" and lists every file of the main target, which points nowhere near the cause. Creating the empty Tests/FooTests directory (git ignores empty directories) lets the package resolve and the library build; `swift build` gives the clearer 'Source files for target ... should be located under' message instead. Check for the missing test directory before debugging target paths.
