When using projects started and managed by Xcode, I let the test files in the same directory as the production-code-files. For instance
Common/Components/ActionButton ├── ActionButton+FormattedTitle.swift ├── ActionButton.swift ├── ActionButtonTest.swift ├── ActionButtonTheme.swift ├── SmallTextField.swift └── __Snapshots__ └── ActionButtonTest ├── testBorderlessActionButton.1.png ├── testBorderlessActionButtonWithMultiColoredTitle.1.png ├── testCustomThemedActionButton.1.png ├── testGhostActionButton.1.png ├── testGhostActionButtonLoading.1.png ├── testGhostActionButtonLoading_WithBigTitle.1.png ├── testPrimaryActionButton.1.png ├── testPrimaryActionButtonLoading.1.png └── testPrimaryActionButtonLoading_WithBigTitle.1.png
I would like to know whether it is possible to do the same with SPM or not. I know that I could ignore files, which means I could ignore the test files on the
Source folder. However, I do not know how to compile the test target with files on the
Source and files that are spread across the code, like in the example above.
So, basically, how to tell the test target it will need to look up for tests on the
Source folder. And, how to make the test target to compile only the test files on
When I am using Xcode, that is quite easy. I just have to mark that file on the target I want it to be compiled into.