Hi all. I'm new to Kotest, but I am loving it. I'm...
# kotest
k
Hi all. I'm new to Kotest, but I am loving it. I'm writing a library that needs to be cross platform so using MPP, and Kotest for my all my tests. I can't seem to run my tests in iOS because of a linking error, and was hoping to get some help.
Copy code
> Task :my-library:linkDebugTestIosX64 FAILED
e: Could not find "io.kotest:kotest-assertions-api" in [ ... ]
FAILURE: Build failed with an exception.
Copy code
// kotestVersion = "5.1.0"
commonTest {
    dependencies {
        implementation "io.kotest:kotest-framework-engine:${rootProject.ext.kotestVersion}"
        implementation "io.kotest:kotest-assertions-core:${rootProject.ext.kotestVersion}"
        implementation "io.kotest:kotest-property:${rootProject.ext.kotestVersion}"
        implementation "io.kotest.extensions:kotest-assertions-arrow:1.2.2"

        runtimeOnly "io.kotest:kotest-assertions-api:${rootProject.ext.kotestVersion}"
    }
}
s
I don't use a mac. Maybe @Imran/Malic has seen a similar error
👍 1
k
Thanks @sam. This is unfortunately blocking my progress so I hope to figure it out soon 😄
I think it's an issue with where the linker is searching for test libs. The
kotest-assertions-api-iosarm64
lib is on disk as is
arrow-core-iosarm64
(which is a
commonMain
dependency). However the linker isn't looking in the
cache
directory in the list of paths. I might ask this question over on the #multiplatform channel.
s
Ok might make sense to ask them yeah
k
I ran
./gradlew iosX64Test --info
and it might be an issue integrating
kotest-assertions-arrow
Copy code
Classpath = [
        /Users/kieran/.konan/kotlin-native-prebuilt-macos-x86_64-1.6.0/konan/lib/kotlin-native.jar
        /Users/kieran/.konan/kotlin-native-prebuilt-macos-x86_64-1.6.0/konan/lib/trove4j.jar
]
Arguments = [
        -p
        static_cache
        -target
        ios_x64
        -g
        -Xexternal-dependencies=/var/folders/90/rnmkftm10551d62mjt897mym0000gn/T/kotlin-native-external-dependencies4001252806988445666.deps
        -Xadd-cache=/Users/kieran/.gradle/caches/modules-2/files-2.1/io.kotest.extensions/kotest-assertions-arrow-iosx64/1.2.2/2da466c9780a787c5b7f8cd310cf37c82b36f754/kotest-assertions-arrow.klib
        -Xcache-directory=/Users/kieran/.konan/kotlin-native-prebuilt-macos-x86_64-1.6.0/klib/cache/ios_x64-gSTATIC/kotest-assertions-arrow-iosx64/1.2.2/7cbae098c9d28e7b9d2d5cc67e2abbde4474614cc1168b690793b82432bd28dc
        -Xcache-directory=/Users/kieran/.konan/kotlin-native-prebuilt-macos-x86_64-1.6.0/klib/cache/ios_x64-gSTATIC
]
Transformed arguments = [
        konanc
        -p
        static_cache
        -target
        ios_x64
        -g
        -Xexternal-dependencies=/var/folders/90/rnmkftm10551d62mjt897mym0000gn/T/kotlin-native-external-dependencies4001252806988445666.deps
        -Xadd-cache=/Users/kieran/.gradle/caches/modules-2/files-2.1/io.kotest.extensions/kotest-assertions-arrow-iosx64/1.2.2/2da466c9780a787c5b7f8cd310cf37c82b36f754/kotest-assertions-arrow.klib
        -Xcache-directory=/Users/kieran/.konan/kotlin-native-prebuilt-macos-x86_64-1.6.0/klib/cache/ios_x64-gSTATIC/kotest-assertions-arrow-iosx64/1.2.2/7cbae098c9d28e7b9d2d5cc67e2abbde4474614cc1168b690793b82432bd28dc
        -Xcache-directory=/Users/kieran/.konan/kotlin-native-prebuilt-macos-x86_64-1.6.0/klib/cache/ios_x64-gSTATIC
]
e: Could not find "io.kotest:kotest-assertions-api" in ...
Maybe when @Imran/Malic is around he can take a look.
s
Does it work if you remove hte arrow deps ?
k
I'm migrating an existing codebase, so it would fail at the compilation step
s
ah
k
I also ported all the tests from Junit to Kotest, and love the Arrow matchers
s
Yeah me too.
@Imran/Malic does most of the work on the arrow matchers and such a good job
k
It issue might be a packaging issue for the native code. as I notice
compileOnly
dependencies which MPP does give a warning about (however they've been suppressed via the
gradle.properties
)
I'm hoping that @Imran/Malic has used the matchers in a native project and can help me figure out what I need to do.
s
maybe
I don't think the arrow stuff itself is entirely setup right for mpp as I can't get the core commons stuff to load on another project
k
Interesting. I haven't had an issue using Arrow itself. It's the tests that have given me issue.
s
Arrow is great, was just having an issue adding it to commonMain
k
If there's anything I can do @Imran/Malic to help, please let me know 😄
i
Hi, @kierans777 I am on a different timezone, that’s why I didn’t answer. Thanks for bringing this up. I was able to reproduce it here https://github.com/arrow-kt/Arrow-MPP-Template/pull/25. Let me create a PR in kotest-arrow to change the dependency tree. And then we can ask @sam to publish a new release I don’t have access to that
k
@Imran/Malic Thanks so much ❤️ (I know from your profile that you're in GMT+1 so I had to wait. I'm in Melbourne Aus so GMT+11)
👌🏾 1
Hopefully @sam can merge/publish when he's awake 😆
i
Issue is set up and let me check with a local publication if my changes work https://github.com/kotest/kotest-extensions-arrow/issues/140
s
Happy for you to merge without me btw
🙏 2
k
I'm probably going to bed now, so tag me if you need anything. Hopefully it's an easy fix 🙏
i
I went through some publications locally, but changing the dependency tree didn’t work. I am going to try something out later after work in 6h. I’ll keep y’all updated
I am going to check out Team City later for issues regarding these two platforms, bc this issue only arises in iosX64 and macosX64 check out the latest commit https://github.com/arrow-kt/Arrow-MPP-Template/pull/25
@sam
I don’t think the arrow stuff itself is entirely setup right for mpp as I can’t get the core commons stuff to load on another project
What for instance the kotlin-stdlib has as
kotlin-stdlib-commons
is in arrow just the artifact name. So in the case of Arrow core it’s just
arrow-core
, the changes in the publication can be seen here https://github.com/arrow-kt/arrow-gradle-config/blob/5037bfd3b6c3bd000163123876635[…]%3Afirst-of-type%2C%20%5Bdata-pjax-container%5D%3Afirst-of-type
s
I was talking about another project I have. I can talk to you about it later on.
👍🏾 1
i
I am probably going to look into this in the following days, and ask other maintainers at Arrow @kierans777, probably we’re doing something wrong while publishing the artifacts in
kotest-assertions-arrow
k
Thanks @Imran/Malic.
I've also had the issue with iosArm64Test
i
Yeah seems all native targets are affected
I had the same with linux, but sorry @kierans777 I couldn't find a fast solution to this. On the weekend I'll have more time to dig deeper and have something merged in the repo
Hi @kierans777 I published a SNAPSHOT
1.1.0.98-SNAPSHOT
which works fine now and I was able to run it here https://github.com/arrow-kt/Arrow-MPP-Template/pull/25/files if it works for you too I can create a
1.3.0
release with those changes or
1.2.3
k
@Imran/Malic The build works now. Great job. Thanks 🙏
💪🏾 1
i
We published
1.2.3
as a stable release thanks to @sam 🙌🏾 and @kierans777 for bringing it up
❤️ 2
Just a heads up, seems like in the
1.2.3
release the watchOsX86 is failing with the current node js version 14.17.0
Copy code
> Task :watchosX86MainKlibrary
356
> Task :compileTestKotlinWatchosX86
357
> Task :linkDebugTestWatchosX86
358
> Task :watchosX86Test SKIPPED
359
> Task :allTests FAILED
360

361

362
FAILURE: Build failed with an exception.
363
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
364

365

366
* What went wrong:
367
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
368
Execution failed for task ':allTests'.
369

370
> Failed to execute all tests:
371
See <https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings>
372
  :jsBrowserTest: java.lang.IllegalStateException: command '/Users/runner/.gradle/nodejs/node-v14.17.0-darwin-x64/bin/node' exited with errors (exit code: 1)
373
67 actionable tasks: 67 executed
https://github.com/arrow-kt/Arrow-MPP-Template/runs/5196846760?check_suite_focus=true I am reverting to the Snapshot to check if this is a problem with out artifacts
👍 1
Just leaving this here for @sam, but the artifact for
1.2.3
doesn’t seem to work on CI builds with a macos 11 runner. https://github.com/arrow-kt/Arrow-MPP-Template/runs/5197021874?check_suite_focus=true I rerun the snapshot and it worked with the same runner. On my local machine macos 12.X both work without issues
everything works fine now @kierans777 in
1.2.3
just merged it here https://github.com/arrow-kt/Arrow-MPP-Template
👍 1