Unable to run Unit Tests with swift test when building for iOS

I understood that it was possible to run unit tests when building for iOS but when doing so I get errors about test macros (XCTAssertTrue, XCTUnwrap, etc) not being found and XCT* related function-like macros not being supported.

"error: cannot find 'XCTAssertTrue' in scope"
"macro 'XCTAssertTrue' not imported: function like macros not supported"

I'm trying to run tests using the command:
swift test -v
-Xswiftc "-sdk"
-Xswiftc "xcrun --sdk iphonesimulator --show-sdk-path"
-Xswiftc "-target"
-Xswiftc "x86_64-apple-ios15.0-simulator"

I understand that a workaround used to be to use the 'generate-xcodeproj' option and then test with xcodebuild -- but that option seems to have been removed.

And I can't just 'xcodebuild test -scheme MyLibrary' because that complains that there's no executable bundle associated with the project.

I'm really at a loss as to how to run unit tests associated with my iOS Package without building a separate Xcode project.