Rohit Verma
05/01/2025, 2:41 PMapi
instead of implementation
When we define some test-dependency for a module, eg - testing
, like this:
commonTest.dependencies {
api(compose.uiTest)
}
Then we cannot access that dependency in a module where I'm implementing testing
module. However, using api should make the dependency transitive but it didn't. Is it a bug or a feature? Because I can easily access the dependency if I define it inside commonMain
source-set using api
.
Please let me know if anyone face this issue and how to deal with it. Thanks :)ephemient
05/01/2025, 4:06 PMcommonTest
only applies within that module. other modules are only exposed to your commonMain
(and other *Main
) sources and dependenciesephemient
05/01/2025, 4:07 PMRohit Verma
05/01/2025, 4:08 PMcommonMain
for defining test dependency to make them transitive? Also, what is test fixture?ephemient
05/01/2025, 4:58 PMmain
for the purpose of sharingephemient
05/01/2025, 5:18 PMVampire
05/01/2025, 7:36 PMapi
.Richard Leggett
05/02/2025, 8:56 AM:some-repo:fake
to access FakeSomeRepo
in another module's commonTest{}
.
// in :some-feature:viewmodel's build.gradle.kts
kotlin {
commonTest.dependencies {
implementation(projects.someRepo.fake)
}
}
That way you are not including your test doubles in production code.