hello, I’m trying to use it in a multiplatform pro...
# power-assert
j
hello, I’m trying to use it in a multiplatform project, that only has android and ios, but it doesn’t seem to work even with the “includedSourceSets”, when I run the tests in commonTest I get the following options in the image, if I run with iosSimulatorArm64 it works, but with the android one it doesn’t, the issue is that we run the tests on a pipeline which always runs them in the android mode, can anyone help?
b
It's probably still a source set problem. Another user was having trouble as well and found that the Android source set name is rather strange: https://kotlinlang.slack.com/archives/C06V6SFE71D/p1716480105604759. We also have an issue for this problem if you want to vote for it: https://youtrack.jetbrains.com/issue/KT-68534/Power-Assert-Android-sources-support. But without a project setup to look at, there's not much more I can suggest.
j
thanks for the reply, I’ve created a sample project where it can be replicated, and I’ve also voted on the ticket. Any help is appreciated, thanks for taking the time to help me!
b
It looks like the source set name you are looking for is
androidUnitTestDebug
. You may also want to add
androidUnitTestRelease
as well depending on your build pipeline. You can print out all source set names that power-assert is matching against with the following task:
Copy code
tasks.create("printSourceSets") {
    doLast {
        kotlin.targets.forEach { target ->
            target.compilations.forEach { compilation ->
                println(compilation.defaultSourceSet.name)
            }
        }
    }
}
I also recommend moving the
powerAssert { }
block to be top-level and not nested under
kotlin { }
.
j
that worked! thanks for the fast support!
🚀 1