I have an iOS library with Swift package manager. I am trying to run unit tests with swift test
The reason why I am not using xcodebuild
is, I am trying to remove the .xcodeproj
from my source control. Also, there is a warning when we create xcodeproj
with spm, that generate-xcodeproj will be deprecated soon.
TL;DR
This library depends on Lottie
I tried just running swift test
in the root directory, but it gives lot of errors. like /.build/checkouts/lottie-ios/lottie-swift/src/Public/Animation/AnimationView.swift:859:11: error: cannot find 'superview' in scope
I tried
swift test -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.5-simulator"
Then it gives the error error: module 'XCTest' was created for incompatible target x86_64-apple-macos10.15
. I did not specify macos10.15 anywhere, I am on macOS 11.5.1
I can build the package using the above command by replacing test
with build
. What is wrong with my test command?
As I understand this is because I am not specifying the target simulator, is it possible to specify the target simulator with swift test
?