Fix: ./gradlew test now passes on a clean tree (android#5) #89
+26
-1
@@ -138,7 +138,32 @@ android {
|
||||
unitTests {
|
||||
isIncludeAndroidResources = true
|
||||
isReturnDefaultValues = true
|
||||
all { it.systemProperty("robolectric.graphicsMode", "NATIVE") }
|
||||
all {
|
||||
it.systemProperty("robolectric.graphicsMode", "NATIVE")
|
||||
|
||||
// 🔴 **The screenshot tests are debug-variant tests, and
|
||||
// `./gradlew test` runs BOTH variants.**
|
||||
//
|
||||
// They launch a `ComponentActivity`, which is declared by
|
||||
// `androidx.compose.ui:ui-test-manifest` — a `debugImplementation`
|
||||
// dependency, so the release variant's merged manifest has no
|
||||
// such activity and all fifteen die with "Unable to resolve
|
||||
// activity for Intent".
|
||||
//
|
||||
// ⚠️ The tempting fix is to add that dependency to release as
|
||||
// well. Do not: it exists to inject a test-only activity into
|
||||
// the manifest, and putting it on `releaseImplementation` would
|
||||
// ship that into the APK. The tests belong to the variant that
|
||||
// can run them.
|
||||
//
|
||||
// ⚠️ Excluded by name rather than by disabling
|
||||
// `testReleaseUnitTest` wholesale — everything else in the
|
||||
// suite still runs in both variants, so a genuine
|
||||
// release-variant difference would still be caught.
|
||||
if (it.name.contains("Release")) {
|
||||
it.exclude("**/ScreenshotTest*")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user