-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make paparazzi aware or unit test dependencies #1468
base: master
Are you sure you want to change the base?
Conversation
paparazzi-gradle-plugin/src/test/projects/multiplatform-plugin-with-android/gradle.properties
Show resolved
Hide resolved
paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PrepareResourcesTask.kt
Outdated
Show resolved
Hide resolved
paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PaparazziPlugin.kt
Outdated
Show resolved
Hide resolved
The issue you're fixing, you can write a failing unit test (gradle project fixture) that only passes if the Paparazzi Plugin has the right wiring. |
Added a module that adds both a |
paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PrepareResourcesTask.kt
Outdated
Show resolved
Hide resolved
I apologize for not giving this a proper review, I intend to do so (finally!) by end of this week. However, I want to share an early concern about changing this to I intend in my review to show what alternative solutions exist to your problem (thank you for the proof-of-concept, btw, it always helps!). Stay tuned. |
I'm having a problem on a project where I have a module that contains composables, those composables depend on a
IconProvider
interface, this interface outputs@DrawableRes Int
. We do not want the UI module to depend on the implementation of this interface. But we do want this implementation available on unit tests.We currently add a
testRuntimeOnly
(could also be atestImplementation
) on this interface implementation and get running espresso tests. But we get weird errors with Paparazzi. Looking into the code, it looks like the dependencies added on the test source set are not added in theConfig
class byPaparazziPlugin
.This PR is my attempt of making Paparazzi aware of resources of local modules and external libraries that are only visible to the test source set.
I have a proof of concept of a composable depending on an interface, and this interface being provided only on the unit tests (it is also provided on the debug variant to make
@Preview
s work). Running./gradlew :poc:ui:testReleaseUnitTest
should fail.I also have the same proof of concept + the code in this PR, and the same task succeeds.
This is my first time contributing to this project, let me know what you think of this. Also, does this deserve a new unit test? I could use some help on this. What would be important testing here?