CLOVIS
07/18/2025, 7:37 PMcommonMain
? I have a module that contains fixtures.
I have
powerAssert {
functions = listOf("kotlin.check")
includedSourceSets = listOf("commonMain", "jvmMain", "jsMain", "nativeMain")
}
but I still get
Check failed.
java.lang.IllegalStateException: Check failed.
at opensavvy.ktmongo.bson.raw.TimestampTestKt.timestamp$lambda$9$lambda$5(TimestampTest.kt:69)
without Power Assert's messagebnorm
07/18/2025, 7:40 PMincludedSourceSets
? https://youtrack.jetbrains.com/issue/KT-68534/Power-Assert-Android-sources-support#focus=Comments-27-10015561.0-0bnorm
07/18/2025, 7:41 PMcommonTest
, jvmTest
, jsTest
, etc to your included source sets. Once you override the default, you need to specify everything.CLOVIS
07/18/2025, 7:41 PM> Task :bson-tests:printSourceSets
iosArm64Main
iosArm64Test
iosSimulatorArm64Main
iosSimulatorArm64Test
iosX64Main
iosX64Test
jsMain
jsTest
jvmMain
jvmTest
linuxArm64Main
linuxArm64Test
linuxX64Main
linuxX64Test
macosArm64Main
macosArm64Test
macosX64Main
macosX64Test
appleMain
commonMain
iosMain
linuxMain
macosMain
commonMain
nativeMain
tvosMain
watchosMain
mingwX64Main
mingwX64Test
tvosArm64Main
tvosArm64Test
tvosSimulatorArm64Main
tvosSimulatorArm64Test
tvosX64Main
tvosX64Test
wasmJsMain
wasmJsTest
watchosArm32Main
watchosArm32Test
watchosArm64Main
watchosArm64Test
watchosSimulatorArm64Main
watchosSimulatorArm64Test
watchosX64Main
watchosX64Test
CLOVIS
07/18/2025, 7:41 PMcommonMain
CLOVIS
07/18/2025, 7:41 PMbnorm
07/18/2025, 7:43 PMjvmMain
looks like it should be enough for tests running on JVM, for example.CLOVIS
07/18/2025, 7:44 PMCLOVIS
07/18/2025, 7:44 PMbnorm
07/18/2025, 7:45 PMCLOVIS
07/18/2025, 7:45 PMCLOVIS
07/18/2025, 7:46 PMCLOVIS
07/18/2025, 7:47 PMCLOVIS
07/18/2025, 7:47 PMpowerAssert
blocks erases the other?bnorm
07/18/2025, 7:49 PMfunctions
since you have it defined in both locations, but I wouldn't suspect that for includedSourceSets
since it's only in your bson-tests
module.bnorm
07/18/2025, 7:50 PMcommonTest
module at all?CLOVIS
07/18/2025, 7:51 PM./gradlew check
globally, :bson-official
and :bson-multiplatform
call the functions declared in :bson-tests
CLOVIS
07/18/2025, 8:00 PMCLOVIS
07/18/2025, 8:00 PMException in thread "main" java.lang.IllegalStateException:
check(1 == 2)
|
false
CLOVIS
07/18/2025, 8:00 PMbnorm
07/18/2025, 9:35 PMjava.lang.IllegalStateException:
check(read("a")?.readTimestamp()?.counter == 4294967294u)
| | | |
| | | false
| | 4294967295
| Timestamp(2106-02-07T06:28:15Z, #4294967295)
Timestamp{value=-1, seconds=-1, inc=-1}
{"a": {"$timestamp": {"t": 4294967295, "i": 4294967295}}}
at opensavvy.ktmongo.bson.raw.TimestampTestKt.timestamp$lambda$15$lambda$9(TimestampTest.kt:69)
bnorm
07/18/2025, 9:37 PM:bson-official:check
worked.bnorm
07/18/2025, 9:48 PM:bson-multiplatform:check
worked (mostly) as I would expect as well. JVM and JS tests showed power-assert enhanced failures while the native tests did not. This is expected because power-assert includedSourceSets
need to be the final compiled source set and not intermediate ones. If you add macosArm64Main
and others instead of nativeMain
, then it seems to work there as well.CLOVIS
07/19/2025, 8:40 AMCLOVIS
07/19/2025, 8:40 AMCLOVIS
07/19/2025, 8:41 AMbnorm
07/19/2025, 2:07 PMdefaultSourceSets
option to the Gradle DSL, configurable to ALL | TEST_ONLY | NONE
or something like that. In the meantime, something like the following might work?
includedSourceSets.set(provider {
kotlin.targets.flatMap { target ->
target.compilations.map { compilation ->
compilation.defaultSourceSet.name
}
}
})