-
|
I am hoping to find a simple way to exclude some tests when running I have an experimental sandbox package that contains native modules + transpiled module & native test modules + transpiled test modules.
Am I misinterpreting the purpose of |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
What it sounds like you really want is the equivalent of However, there is a not-nice way of doing it, which is to gate the inclusion of your testing targets in the // swift-tools-version: 5.9
import PackageDescription
let package = Package(
name: "skip-android-bridge",
defaultLocalization: "en",
platforms: [.iOS(.v16), .macOS(.v13), .tvOS(.v16), .watchOS(.v9), .macCatalyst(.v16)],
products: [
.library(name: "SkipAndroidBridge", type: .dynamic, targets: ["SkipAndroidBridge"]),
.library(name: "SkipAndroidBridgeSamples", type: .dynamic, targets: ["SkipAndroidBridgeSamples"]),
],
dependencies: [
.package(url: "https://source.skip.tools/skip.git", from: "1.2.34"),
.package(url: "https://source.skip.tools/skip-foundation.git", from: "1.3.1"),
.package(url: "https://source.skip.tools/swift-jni.git", "0.0.0"..<"2.0.0"),
.package(url: "https://source.skip.tools/skip-bridge.git", "0.0.0"..<"2.0.0"),
.package(url: "https://source.skip.tools/swift-android-native.git", from: "1.4.1")
],
targets: [
.target(name: "SkipAndroidBridge", dependencies: [
.product(name: "SkipBridge", package: "skip-bridge"),
.product(name: "SwiftJNI", package: "swift-jni"),
.product(name: "SkipFoundation", package: "skip-foundation"),
.product(name: "AndroidNative", package: "swift-android-native", condition: .when(platforms: [.android])),
], plugins: [.plugin(name: "skipstone", package: "skip")]),
.testTarget(name: "SkipAndroidBridgeTests", dependencies: [
"SkipAndroidBridge",
.product(name: "SkipTest", package: "skip"),
], plugins: [.plugin(name: "skipstone", package: "skip")]),
.target(name: "SkipAndroidBridgeSamples", dependencies: [
"SkipAndroidBridge",
], resources: [.process("Resources")], plugins: [.plugin(name: "skipstone", package: "skip")]),
.testTarget(name: "SkipAndroidBridgeSamplesTests", dependencies: [
"SkipAndroidBridgeSamples",
.product(name: "SkipTest", package: "skip"),
], plugins: [.plugin(name: "skipstone", package: "skip")]),
]
)
if Context.environment["DISABLE_TRANSPILED_TESTS"] == "1" {
// filter out any testing targets that are transpiled…
package.targets = package.targets.filter({ $0.name != "SkipAndroidBridgeSamplesTests" })
}
if Context.environment["DISABLE_COMPILED_TESTS"] == "1" {
// filter out any testing targets that are compiled…
package.targets = package.targets.filter({ $0.name != "SkipAndroidBridgeTests" })
}So to run tests against just the compiled parts, you should be able to run: Similarly, if you want to just run the transpiled tests, you could run: Let us know if that works for you. If not, we might be able to figure out another workaround for this limitation. |
Beta Was this translation helpful? Give feedback.
--testing-librarymeans something different: it is really an internal flag that specifies whether to run the test cases in "XCTest" mode versus "Swift Testing" mode.What it sounds like you really want is the equivalent of
swift test --filter MyNativeTestModuleto run only the tests in the packages specified in the filter. Unfortunately,skip android testdoesn't support the--filterflag (due to bugs in Swift Testing beyond our control). So there's no nice way of doing it.However, there is a not-nice way of doing it, which is to gate the inclusion of your testing targets in the
Package.swiftwithin an environment variable check. Off the top of my head, it would look something like this …