> > Task :arrow-optics:jsLegacyBrowserTest &...
# kotest
s
Task arrow opticsjsLegacyBrowserTest
Disconnected (0 times) reconnect failed before timeout of 2000ms (ping timeout)
java.lang.IllegalStateException: command '/Users/simonvergauwen/.gradle/nodejs/node-v14.15.4-darwin-x64/bin/node' exited with errors (exit code: 1)
Anyone has any tips to figure out a better output for JS? I'm not even sure which file is failing 😕 Strangest thing, when I run
:arrow-core:cleanJsLegacyBrowserTest :arrow-core:jsLegacyBrowserTest
from IDEA then all tests pass, but when I run
clean build
then it fails with the above error (same failure on CI). https://github.com/arrow-kt/arrow/pull/2441 EDIT: It's is strange because I just checked the test reports with this failure, and all test reports report 100% successfull.
s
Is this being caused by IR or legacy or both
s
It's only happening for legacy. JS IR is not running for Kotest, right?
It seems that's also only happening for
jsLegacyBrowserTest
. I haven't seen it for
jsLegacyNodeTest
, but not sure about the details of how those tests run. If they run in sequence, then that might also be the reason why I never see the
jsLegacyNodeTest
fail.
s
Ok thanks, I'll look into it
In master we now have a compiler plugin that runs Kotest on IR, FYI
😍 1
s
Amazing! Nice work 👏 👏 👏
Hey @sam, Any update on ETA for IR/Native support? Do you think we can expect it this month or beginning of Sept?
s
Yes. It works now. I just need to get it packaged up so it's easy to use
Which is a bunch of steps unless you know kotest
So 1. Get the gradle plugin pushing to gradle repo automatically
2. Release RC of compiler plugin for IR
3. Use any 5.0 kotest snapshot
I maybe can complete it this weekend
s
Awesome 🥳 Please let me know, I’d love to take it for a spin!
s
Will do!
s
Amazing work 👏 👏 👏 Big kudos
s
Thank you 😊
Works for native too btw
❤️ 1
s
Will be powering Arrow native test as soon as available
🎉 1
s
Do you want to test out the beta JS / Native support? Even if it's just to tell me it doesn't work for you: 😂 @simon.vergauwen
s
Absolutely! I can only try out IR for now, still working on getting native running.
I’m a bit confused with which targets I need to add. I’ve been looking at the Kotest config for inspiration. Nicely setup there
Btw there is a
getTimeMillis
for native in
kotlin.system
for Native, I saw you had it disabled. I only don’t know how to get access to
kotlin.system
from a module like
nativeMain
only in the actual platform folders I have access to it.
Any tips on how you choose your targets would be appreciated 😄 I’m going to try out JS IR right now
s
I have all the targets set up 🙂
anything that we can possibly compile to, we compile to
s
@sam running into some issues:
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find io.kotest:kotest-framework-multiplatform-plugin-js-jvm:5.0.0.3.
I pushed it to
sv-kotest-mpp
if you want to check it out
I also seem to miss some dependencies for that version which Arrow depends on kotest-property etc
Seemed jvm modules, are those not published?
I have all the targets set up 🙂
Awesome, then I’m going to follow your example 😁 Thanks!
Should I change
JS(BOTH)
to
JS(IR)
?
s
yeah JS(IR)
legacy isn't supported anymore
and I see your error straight away
I will need to push out a fix 😂
good start
s
Ye, I get almost the same error if I change to
JS(IR)
.
s
teh issue is the gradle plugin is using the gradle plugins version when looking for the compiler plugin version
but they don't match
locally I override it all
let me push a change
👍 1
s
Should we not support
BOTH
anymore? And/or will I still be able to generate the binaries for legacy as long as it’s suggested to do so?
s
you can generate the binaries but you won't be able to run the tests
legacy JS support was a bit of a hack
s
That’s fine
s
IR JS support is done properly through a compiler plugin
😍 1
I even have things like before / after project working
which isn't possible with jetbrains kotlin.test
s
Does that mean I can also get rid of those weird things with
karma.js
under the hood etc?
s
you shouldn't need to do any of that anymore
s
That’s amazing! 👏 👏
s
can you link me to your build
s
s
where's the gradle file
s
I can rebuild the build locally whenever you want
s
Ok let me play with this a bit, I'll probably come back to you tonight
I'll update my examples javascript project which has a ready to go IR based kotest example
s
Alright, cool.
s
It all works locally
It issue is just getting some versions lined up. I override it all locally to use LOCAL versions from my ~/.m2 folder
I'll fix that and we should be good to go
👍 1
might be something in your setup actually, I just setup the latest snapshots on here: https://github.com/kotest/kotest-examples-javascript
And it works
Try cloning that project see what you think, it shows how it sits together
s
Actually I think I just got Arrow compiling for the same native platforms as Kotest. So this is also supposed to work for Native already?
s
Yep I have another examples project showing native support.
s
I’m going to try that repo and see if I made any mistakes in my setup. I’ll report back later
s
ok cool
s
Awesome, can you also share that link?
s
I'll push up the native examples one after my next meeting
👍 1
s
breaking change 😂 test compiling but had to disable legacy JS, just having that on failed the test step before compiling
@sam making progress 😄
I was using version
5.0.0.3
for the dependencies as well instead of the
-SNAPSHOT
version
s
You should use the same deps as that example project I gave
5.0.0.3 only exists as a "snapshot" release of the gradle plugin. All other deps should be the 5.0.0.376-SNAPSHOT version
In other words the gradle plugin is not automatically released on every build, whereas kotest everything else is
When we release it properly, the numbers will sync
s
I have it like that right now
But I’m running into the linked crash
All dependencies are on
5.0.0.376-SNAPSHOT version
and the plugin is
5.0.0.3
s
That looks to me like the right engine dep isn't on the classpath
s
I tried explicitly adding all
-js
dependencies but that didn’t do anything.
s
do you have
kotest-framework-engine-js
on the classpath
s
I tried explicitly adding it but didn’t work.
s
You can see in the JS examples project which deps you need
did you add teh maven snapshots repository ?
Copy code
maven("<https://oss.sonatype.org/content/repositories/snapshots>")
s
This should be enough for the engine, right?
s
Yes but you need the maven snapshot repo if you're using snapshot resources
eg
Copy code
repositories {
   mavenCentral()
   mavenLocal()
   maven("<https://oss.sonatype.org/content/repositories/snapshots>")
}
and if you add to commonTest you shouldn't need to also add to jsTest, but you can leave it like that for now until you fix this issue 🙂
s
Yes, I had snapshot everywhere
Sec, this is probably clear what my changes are
And now I touched all build files that have something kotest related I think
and if you add to commonTest you shouldn’t need to also add to jsTest, but you can leave it like that for now until you fix this issue
Same goes for framework-api and assertions? But those couldn’t result in this error, right?
s
The error is that the compiler plugin is not finding the TestEngine which lives in engine-js or engine-native
Your build is quite complex compared to the examples repo so it might be that the gradle plugin is incorrectly detecting the version to use
I can make a change to the gradle plugin so that you can manually override the version. Right now it tries to find the engine dep on your build and use that version number. So it should be picking up 376-snapshot and then using that version for the compiler plugin. If the version wasn't found at all, then it would throw an error.
s
It’s all showing up here
s
Perhaps you have other non-snapshot versions of kotest somewhere and that's the version the gradle plugin is detetcting
s
Uhm, let me try adding invalidating strategy to avoid that
s
See I do this:
Copy code
return project.configurations.flatMap { it.all }.flatMap { it.dependencies }
   .find { it.group == "io.kotest" && it.name.startsWith("kotest-framework-engine") }?.version
this way, whenever you bump kotest, the gradle plugin should just automatically use the same version for its stuff
But the error you are getting indicates ether the engine dep is missing completely, or is an older version prior to me adding
Copy code
TestEngine
Inside one of your tests, see if you can do
val engine =TestEngine()
that will let us know if the IDE can at least resolve the right version
s
Ye, that works fine
s
yeah ok
I will add a bunch of debugging output to the gradle plugin
but it will have to be after work
I feel like we're close tho
s
Ye I think we’re pretty close
s
Once you have it working I will cut a M1 release so you're not using snapshots
Kotest 5.0 is coming along really quickly
s
Awesome!
I think we’re in different timezones 😛 But if you add logging, I will run it in the morning
I tried getting the plugin for
5.0.0.376
and
5.0.0.376-SNAPSHOT
to align with the runtime version but those didn’t load
s
The gradle plugin is only 5.0.0.3. It's annoying but because they go to different artifactories
s
Available to run another build whenever 👍
s
I can't figure out what to change to make this work for you
s
Damn 😕
Did you try locally?
And/or can we try making an MPP example combining the JS, Native example with a JVM example?
s
Let me do that second thing because that might expose some issues yeah
s
Hey @sam, Any luck?
s
Sorry bear with me, been super busy at work, I will get on this ASAP as I know you're waiting
s
No worries @sam! Don’t feel pressured because of me (or Arrow) please 😅 Take care, and I’ll hear it when you had some time to look at this 👍
If there is anything I can help with to debug or anything also please let me know 😉
❤️ 1
s
This is a project with JVM, JS and native tests. https://github.com/kotest/kotest-examples-multiplatform There is a github actions for windows, mac and linux to show it working on all platforms too. I think the issue from last week is that framework-engine was only published for linux and not windows or mac. I'm on linux so didn't see any problem and I'm guessing you're on mac.
s
Hey Sam, I am on Mac indeed. I’m going to try your sample project, and updating the Arrow branch if needed. I’ll report here
👍🏻 1
Good news. 1. Demo project compiled and build locally (MacOs Catalina) 2. Updated Arrow, all artefacts are being resolved and building 🥳 => In progress of fixing Gradle setup (??) Seeing weird things such
destinationDir is null
and
ConcurrentModificationException
coming from Gradle itself 🤕 Additionally, it’s not working with
JS(BOTH)
only with
JS(IR)
since it says it cannot resolve the dependencies for legacy. Which is fine, but I’d still like to produce legacy for the time being (until Kotlin recommends to not do it anymore). So I’m also still looking for a way to disable tests for legacy so it will just ignore those tasks, and not try to resolve it dependencies.
s
I think there is like testJsIr and testJsLegacy or similar
So you could just run one
Rather than test or check
s
Okay, if I can do that that’d be fine. Although it breaks
check
,
test
,
build
tasks 😕
I’ve tried to do this for something else in the passed, by excluding tasks but I never got that working
I’m running into
Copy code
Execution failed for task ':kotlinNpmInstall'.
> Cannot find karma@6.3.2 in yarn.lock
Any ideas?
s
Does this happen for my project or arrow
s
On Arrow when I bumped versions
I think it’s unrelated to Kotest
s
You shouldn't need to configure karma etc in kotlin 1.5
the mpp plugin will pull it down and configure it
try deleting the yarn.lock file, all that does is lock the versions in place
s
Those should be gone after a
clean
, right?
Copy code
Execution failed for task ':arrow-core:macosX64Test'.
> Test running process exited unexpectedly.
😅
s
a clean (in javascript) wouldn't clear yarn.lock
I don't know if it should in kotlin
I guess I can look at your arrow builds
🙏 1
would be later on then
s
The error from
macosX64Test
doesn’t seem to come from Kotest either.
s
Copy code
at org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesClient.ensureNodesClosed(TCServiceMessagesClient.kt:537)
that is from a test
s
Can I see any errors from the test?
s
do you have any non kotest tests ?
s
No, don’t think so let me check
I see some JUnit on some classpaths but no
@Test
I’m gonna try cleaning those too before I push
s
Where's this branch ?
s
Nvm, it’s only on jvm only modules that don’t have the new kotest plugin applied and are used jvm only
s
ok ping me when its ready and I'll look tongiht after work
s
I got a lot more moving now 🤞
Can
iosX64
run on MacOs without doing anything? 😮
s
I think so, I don't use a mac for kotest myself, but the github actions builds just work on macos
s
RIP build times
😂
s
haha definitely
s
Seeing this with some of these targets:
Copy code
> Task :arrow-core:watchosX64Test

Child process terminated with signal 11: Segmentation fault
Test running process exited unexpectedly.


> Task :arrow-optics:watchosX86Test

Child process terminated with signal 11: Segmentation fault
Test running process exited unexpectedly.
Saw same from tv targets, and think also ios.
Maybe I’m missing some local installation for this
s
I mean nothing any of our code is doing should be causing seg faults
I guess you have some funky stuff in there
I wonder if arrow will be the ultimate test for the native compiler 🙂
s
There is nothing funky left since 0.13.2 tbh. It’s all simple sealed/data class in Arrow Core, no more
Kind
or
Functor
hierarchy. Arrow Fx Coroutines is simply on top of KotlinX Coroutines, and Optics are 6 interfaces with a bunch of implementations.
Atomic Fu is probably the most exotic 😄
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':arrow-continuations:allTests'.
> Failed to execute all tests:
  :arrow-continuations:iosX64Test: Test running process exited unexpectedly.
  :arrow-continuations:macosX64Test: Test running process exited unexpectedly.
  :arrow-continuations:tvosX64Test: Test running process exited unexpectedly.
  :arrow-continuations:watchosX64Test: Test running process exited unexpectedly.
  :arrow-continuations:watchosX86Test: Test running process exited unexpectedly.
  :arrow-continuations:jsBrowserTest: java.lang.IllegalStateException: command '/Users/simonvergauwen/.gradle/nodejs/node-v14.15.4-darwin-x64/bin/node' exited with errors (exit code: 1)
Gonna push it now
Done
s
branch ?
s
poc-native
I also set up Linux, Windows and Mac Os workflows on that PR
s
Could not resolve org.jetbrains.kotlinxatomicfu js0.16.2. Required by: project :arrow-continuations
s
That’s very strange 😕 It definitely exists and can be found here: https://search.maven.org/artifact/org.jetbrains.kotlinx/atomicfu-js/0.16.2/pom And it resolves fine locally for me, and also on Github Actions in the PR.
s
I don't know why it can't find it, but your build is really complex with multiple settings files (I've not seen that before)
I stripped the project down to only a couple of modules and the karma error goes away
but I cannot get JS tests to show up yet (but the JVM ones run)
Can you make me a branch I can push to ?
s
Absolutely. You can pretty much ignore everything. Only open
arrow-libs
which is the “project” folder with the top-level
settings.gradle
and that is a regular project with all modules as subProject
In the nested folders
fx
,
optics
and
core
you can also find
settings.gradle
but you can just ignore it
I stripped the project down to only a couple of modules and the karma error goes away
So you’re @ the same stage I was when I pushed last night 😅
s
Yeah I can push up what I've done later to a branch or fork
s
I saw that
jsTest
was failing on CI due to an
abstract fun
inside a
sealed class
for JS.. It was nothing critical but wasn’t expecting this. Could that be something that happens only for
IR
, so it wasn’t generating in incorrect bytecode for legacy? For native it’s still
> Test running process exited unexpectedly.
I’m not sure how I can create a branch where you can push.. 🤔
If you think it’s related to the Gradle setup, I can strip it out and turn it into a flattened Gradle project for you
Shouldn’t take too long.
Actually, I’m gonna prep that on a branch. I was already considering doing that anyway, and probably will after 1.0.0
s
you would need to make me a contributor or something
s
I can do that
You should be able to create a branch, and push directly to Arrow now @sam
s
Great. I'll create a branch after work and continue trying to get the JS stuff running
I think its just something simple
s
I made a branch that flattens the Gradle hierarchy.
poc-native-flat
, feel free to push there. This is where we setup the “subprojects” (arrow-core, arrow-continuations, …) https://github.com/arrow-kt/arrow/blob/poc-native-flat/gradle/subproject-mpp.gradle And here on line 3 we setup
kotest.multiplatform
and on line 7 we include the script linked above. https://github.com/arrow-kt/arrow/blob/poc-native-flat/core/arrow-continuations/build.gradle
kotest.multiplatform
is setup in all subprojects inside
core
except for
retrofit
which is JVM only and also uses a JVM only setup script.
s
well my branch has loads of stuff deleted
so I'd rather not push over yours
It's odd you guys have a module for retrofit
I think that library is absolutely awful 😂
s
Haha, it was a contribution and afaik it’s still quite popular on Android. I haven’t used it myself for years
s
Yeah, it's popular and robust and no doubt fast, but it just flies in the face of FP 🙂 Like annotated interfaces and generated code, ugh no thanks 🙂
💯 1
I haven't forgotton about this btw, still working through it
🙏 1
s
Take your time, you know where to find me if I can help with anything!
s
Looks like the compiler plugin isn't being applied to the build
Getting somewhere, I can see the tests being picked up
ok success
s
😍
s
I've had to hack your build to bits, but I've got JS tests showing up
s
Super exciting
That’s fine @sam!
s
just waiting on a kotest build now (my local changes to build on the server)
then I can push to a branch and you can see - then the hard work begins
👀 1
There is a caveat - you cannot use FreeSpec and things with JS
s
Are we not using
StringSpec
everywhere?
s
no
most places
JS test frameworks do not support promises anywhere other than the leaf test - so in order to make JS tests work with kotest, we have to disallow anything other than string spec, fun spec and should spec
But it should be an easy update for you as your FreeSpec looks like its just string spec anyway
s
Yes, it should all be
StringSpec
and if it’s not I can refactor them
So feel free to just comment them out and ignore them
s
🦜 1
Well I deleted all except one test :)
as I wanted to focus
only because I wanted to get rid of unitspec
just to rule it out
s
lol they seem to run a lot faster than before too 😮
s
with native
s
NICE!!!
This is super exciting!! Huge milestone for testing in Kotlin MPP 🙌 Big kudos again
s
thanks 🙂
s
I know what I’m doing Sunday when it’s going to be raining all day ^^
s
lolol
wish it would rain here
my garden is drying up
s
Wettest summer since 1830 here (when they started measuring). We had like 1 week of sun so far lol
s
wow
where is here
s
Antwerp, Belgium. But it’s West Europe in general
s
yep been to antwerp
diamonds
s
UK, North France, Netherlands, Germany, all same weather this summer.
😮 Awesome, that’s like 10m from my place
s
been all over belgium
🙌 1
best beer
s
Yes 😬
s
belgium is one of my favourite countries
only 2 hours from london on the train, very easy to get to
s
That’s pretty cool to here, if you ever make it here again I’d be happy to take you around for some cool beer cafes 😉
s
I'm in the UK next week
but not belgium something something covid
s
Ye, I travel to London by train. It’s super easy
Ye, hope we can travel normally again soon-ish
s
something in the native compiler sends my computer crazy when compiling the native code
but the tests do run eventually
ok checkout
poc-mpp-sam
branch
you got enough to unblock you ?
s
Sorry, I haven’t had any time to check it yet right now. I’m still trying to finish something important before the weekend starts 😅
If you got it running in a subset of Arrow, then I’m sure I have enough info 👍 If I run in anything I’ll post here
👍🏻 1
I just quickly checked the commit, and there is enough info for me to go on. I saw you still had
mavenLocal
in the config, did you try running locally without it?
s
I had that while I was testing local versions of the plugin
Then I built on server and updated to a proper snapshot
Should be fine to remove the local repo
👍 1
s
If I put
arrow-core-test
on the classpath than tests fail to run for native. Works fine for JS. Strange thing is I have it working with
arrow-core
, but I ran in a scenario where if
native
worked that
JS/JVM
couldn’t load dependencies anymore, and seems to be other way around too.
Never-mind that, I just ran
./gradlew :arrow-continuations:macosX64Test :arrow-continuations:jsTest :arrow-continuations:jvmTest
successfully locally 🦜
The dependency config is a bit weird though 😅 I seem to have to redeclare some stuff a couple times, so my Gradle magic is probably a bit off 😂
Ye, okay. Something is going wrong with
arrow-core-test
but I’m not sure what
If it’s on the classpath then native won’t run
Even when it’s not being used
Still had
id("io.kotest.multiplatform")
in
plugins { }
in
arrow-core-test
Could you try runing
./gradlew :arrow-core:macosX64Test
? For me it only runs a single test file, instead of all tests in Arrow Core.
s
I don't have a mac
so macosX64Test would never work for me
s
Or Any other native target?. I’m not sure what’s happening underneath in the code, so I have nothing I can reason about 😅 But I’ll try to get it running first on CI, then we can just check the test reports to verify if it all ran or not
s
➜ /home/sam/development/workspace/arrow/arrow-libs git:(poc-native) ./gradlew arrow corelinuxX64Test Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Configure project :
.& .@&. .@@&&. .@@@&&&. .@@@@&&&&. .@@@@@&&&&&. .@@@@@@&&&&&&. .@@@@@@@&&&&&&&. .@@@@@@@@&&&&&&&&. .@@@@@@@@@&&&&&&&&&. .@@@@@@@@@@&&&&&&&&&&. .@@@@@@@@@@@&&&&&&&&&&&. .@@@@@@@@@@@@&&&&&&&&&&&&. .@@@@@@@@@@%. .%&&&&&&&&&&. .@@@@@@@%. %. .% .%&&&&&&&. .@@@%. .%%. .#&&&. .@%. ` .%&. ARROW A library for Typed Functional Programming in Kotlin v1.0.0-SNAPSHOT (Kotlin 1.5.21) arrow-libs [arrow corelinuxX64Test]
can you make me a cool banner for Kotest 😂
BUILD SUCCESSFUL in 1m 44s 7 actionable tasks: 7 executed
I don't see any tests in the console output
s
Test are only getting logged for JVM for me
Is logging for mpp already supported?
s
by logged you mean output ?
hmmm looks like they don't appear when using gradle
I'll have to look into that, they do appear in intellij
👍 1
s
Yes, I meant logging the test names in Gradle like JUnit can do. When I ran
arrow-core:macosX64Test
then the generated test report said it only ran
8
test from
1
file.
s
Just looking at it now it seems like the kotlin gradle runner doesn't setup the output writer the same way
if you run the gradle task from within intellij, rather than the command line, you should see output
👍 1
s
Yes, same result in IntelliJ. This is the output of
./gradlew :arrow-core:clean :arrow-core:macosX64Test
run from IDEA.
s
what's what you expect right ?
s
For all tests to run 😅
This is
commonTest
for Arrow Core
s
I'm confused
Are you saying its wrong or right
s
It’s wrong.
s
because its missing the others ?
s
Yes
s
Are they string spec ?
s
Yes, all is StringSpec
I’m working on the PR branch
s
poc-native ?
s
I’m fixing CI, so you can see the test-result straight in Github Actions
👍🏻 1
Yes, that’s the branch if you want to check it locally
I’m confused
Sorry 😅
😂 1
Does this ring any bells?
Copy code
<test id='macosX64Test' parentId=''><ijLogEol/>
    <descriptor name='macosX64Test' className='' /><ijLogEol/>
  </test><ijLogEol/>
</event></ijLog>

  <test id='macosX64Test' parentId=''><ijLogEol/>
    <descriptor name='macosX64Test' className='' /><ijLogEol/>
    <result resultType='SKIPPED' startTime='1629492800330' endTime='1629492803166'><ijLogEol/>
      <failureType>error</failureType><ijLogEol/>
    </result><ijLogEol/>
  </test><ijLogEol/>
</event></ijLog>
s
not really
s
All test are running, except Optics (and only first file in Native). Made a ton of progress today though 😄
@sam the issue with Native tests is also reproducible in
kotest-example-multiplatform
if you add multiple test files
s
ok should be easier to fix there
s
https://github.com/arrow-kt/arrow/runs/3385457458
./gradlew :arrow-fx-stm:jsTest
I had those manually configure before through he
karma.conf.js
trick. https://kotlinlang.org/docs/js-project-setup.html#karma-configuration
s
We should be able to set that directly on the promise
2000 is the default karma timeout
Let me test this now
you making good progress otherwise ?
s
Ye, just trying to figure out which test file is making Optics fail to run
Besides that and the 2 things discussed above it all seems to be working 🙌
s
I think you're making great progress
you guys thought about making a FP addition for Result ?
I'd add it for you 🙂
s
you guys thought about making a FP addition for Result ?
What do you mean? We want to add result { } blocks, and perhaps some extension when kotlin.Result is stable
s
That's what i meant yeah
If you use 5.0.0.401-SNAPSHOT it should work
🙏 1
s
This was Arrow’s
karma
config btw, I had to increase some other timeouts as well. Note I set them all super high here, since I was able to rely on Kotest timeouts even with these ridiculous high timeouts on Karma. https://github.com/arrow-kt/arrow/blob/main/arrow-libs/karma.config.d/karma.conf.js
s
Sorry I don't know what you mean by 'Shouldn’t this be the param configured through Kotest'
And your point of setting karma timeouts high and using kotest is a good one. Perhaps that's the smarter thing for me to.
That PR just sets kotest timeouts onto karma/mocha on a per test basis
👍 1
s
Now you’ve hardcoded it to
4000
, and the comments says
// some frameworks default to a 2000 timeout,    // we can change this to the kotest test setting
. So here I expected the
4000
to be the default project timeout setting from global settings, spec configured timeout or test configured time-out
s
oooooops yes
the 4000 was me testing that it works
it should absolutely just be testCase.timeout
👍 1
Let me fix that 😂
s
Ye, it caught my eye when browsing the changes 😄
s
but I might do what you said
timeout(Int.Max) or something
and use kotest's own timeouts
s
Ye, that worked perfect for me before
s
Copy code
// some frameworks default to a 2000 timeout,
               // here we set to a high number and use the timeout support kotest provides via coroutines
               test.timeout(Int.MAX_VALUE)
👌 1
pushed
takes ~25m for a build
s
Does that go on same version?
No you'll need 5.0.0.403-SNAPSHOT once it's built
s
Cool, thanks
s
Btw I'm planning on cutting a 5.0.0-M1 build soon so you can rely on a non snapshot if that helps
s
Yes, that’d be awesome! Given the process we’re making maybe next week 🤞
s
I'm away Tues to Tues, so I want to do it before then
👍 1
s
After the new version is build I’m gonna disable test in Optics, so we should see a green build on CI. Meanwhile I’m playing hide and seek with faulty test file in Optics but that shouldn’t take long
s
nice
btw if you find things that you use in kotest JVM that don't exist on kotest JS/Native let me know. They're different engines but I've been abstracting and slowly bringing features from JVM to All
At the moment the MPP engine is of course way less featured than the JVM engine
s
That’s fine, in Arrow itself we don’t have a lot of elaborate tricks like I have in some client projects.
No complex docker/test-containers setups, or weird pre/after database cleaning-up to do or any of that stuff
Also if you’re interested? I can make a Gradle contribution to Kotest 😛
s
love it 🙂
s
Cool, happy to contribute it to Kotest 😄
s
most important thing added for ages 😂
s
Think I found a culprit for why the tests aren’t running in Optics.
Copy code
at kotlin.native.internal#ThrowNoWhenBranchMatchedException(/Users/teamcity2/buildAgent/work/7c4fade2802b7783/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:64)
	at io.kotest.property.Gen#minIterations(/Users/runner/work/kotest/kotest/kotest-property/src/commonMain/kotlin/io/kotest/property/Gen.kt:63)
	at io.kotest.property#calculateMinimumIterations(/Users/runner/work/kotest/kotest/kotest-property/src/commonMain/kotlin/io/kotest/property/config.kt:42)
	at io.kotest.property#computeDefaultIteration(/Users/runner/work/kotest/kotest/kotest-property/src/commonMain/kotlin/io/kotest/property/config.kt:28)
	at io.kotest.property#checkAll(/Users/runner/work/kotest/kotest/kotest-property/src/commonMain/kotlin/io/kotest/property/propertyTest1.kt:16)
s
Copy code
Gen.kt:63
Copy code
fun minIterations(): Int = when (this) {
   is Arb -> 1
   is Exhaustive -> this.values.size
}
s
That’s strange..
s
Yeah it's an ADT with 2 cases
s
Let me try manually providing iterations, then it should not pass those methods, right?
s
Must be a bug in the compiler
no it will always invoke that
because it will check your iterations >= min iterations
are you using arb's only in that test ?
s
No, in all of them 😕 Works fine in Arrow Fx & Arrow Core
s
I mean are you using Arbs or Exhaustives or both
I can replace the code with this:
Copy code
fun minIterations(): Int = when (this) {
      is Exhaustive -> this.values.size
      else -> 1
   }
Which shouldn't be required but is the same thing and might get past teh compiler issue
s
I’m using
Arb
everywhere at the moment, I’ve been looking at Exhaustive but since we have a lot of
Arb.string
anywhere it doesn’t seem to make sense. I think it would make more sense on client projects where domain models are much more constraint
s
Right, Exhaustive is good for enums and tight number ranges too
anyway I've pushed that change, let's hope it gets past that compiler issue
but we should file a bug with JB
s
I’m checking something else. That test is using
checkAll { s: String ->
which I thought we weren’t using anywhere in Arrow anymore
Yes, that seems to be have been the culprit
s
What are you using instead
s
I’ve commend them out now, but replacing with
checkAll(Arb.string())
as we speak
s
and that doesn't trigger the bug ?
Might be reflection based then because
checkAll { s: String
might not work on native, it uses reflection on the parameter types
s
Yes, that’s probably what’s happening. Really strange though, and not sure how it ends up in the
when
with an incorrect type. I guess it’s doing
when(null) { is Arb -> … is Exhausive -> … }
which fails
s
Yeah that makes sense that a null is getting into the system somehow, but either way that indicates a compiler bug to me
💯 1
s
Yes, that’s for sure.
Made the fixes, and bumped to the latest version
5.0.0.403-SNAPSHOT
. Let’s see what happens. https://github.com/arrow-kt/arrow/pull/2466 👀 The bug where only the first out of all test files runs for native is still open, correct?
s
Ah yes forgot about that. Let me look shortly just working on some other part right now
I've updated the native examples project and I can see the behavior you're getting: https://github.com/kotest/kotest-examples-native/tree/master/src/desktopTest/kotlin
So now to figure out why it's only picking up one file
Once built, 5.0.0.407-SNAPSHOT will execute multiple files in native mode
🥳 1
s
Awesome!! 👏👏
I’ll try and report back later
👍🏻 1
All native tests are running on latest version
s
🎉
s
I still seem to miss some other configs for JS, I’m going to try adding the karma.conf.js again
Aha failing test in Core 😄
s
but really close then
s
I’m missing some other configurations for Karma I think. I saw
NoActivity
timeout on CI, and I remember I did a dance that ended up with these 3 for CI. After these 3 were that CI became stable for Arrow with the legacy JS testing. https://github.com/arrow-kt/arrow/blob/main/arrow-libs/karma.config.d/karma.conf.js
Copy code
"pingTimeout": 600000,
  "browserNoActivityTimeout": 600000,
  "browserDisconnectTimeout": 600000
Native doesn’t seem to generate a report for the failed test suite, not super critical but would be handy figuring out what failed
There is currently no way to globally override the default iterations, right? Or the depth of collection such as
Arb.list
?
Is that a contribution you might be interested in the future? Then Arrow can get rid of
UnitSpec
and
ArrowFxSpec
and just use
StringSpec
everywhere and just expose a top-level function to add laws testing into a
Spec
as an extension on
TestConfiguration
.
Seeing this in Arrow Fx STM for
./gradlew :arrow-fx-stm:jsTest
.
This hangs until Github Actions timeouts.
s
To set the default arbs, you can use
Copy code
PropertyTesting.defaultIterationCount = 987
👍 1
s
Arrow MPP Native is green!!! @sam
s
❤️
s
I think for Arrow JS only those 3 configurations for karma are missing
s
you can add those to your karma config file
and you should be good
s
Okay, then maybe I’m still seeing something else weird 😄
I’m running into a couple Kotlin Native compiler bugs here and there
s
yeah I mean this is all very beta in kotest
and the kotlin support itself is still immature
to have arrow running native through kotest is pretty impressive imo
s
Yes, it’s very impressive
s
once arrow is MPP I can ditch my roll-your-own Try types
🥳 1
s
I think we need to change this to
else -> 1
. I’m still seeing that error in Arrow Optics on
411-SNAPSHOT
https://github.com/kotest/kotest/blob/master/kotest-property/src/commonMain/kotlin/io/kotest/property/Gen.kt#L62
Tbh I am really surprised by the error. I have 2 other test files that pass with exactly same code.
UnitSpec : StringSpec
and
checkAll
.
And the 3rd file fails, no matter which file.
This only happens in Optics mind blown
Or maybe
abstract fun minIterations()
Copy code
(/Users/teamcity2/buildAgent/work/7c4fade2802b7783/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:135)
	at kotlin.native.internal#ThrowNoWhenBranchMatchedException(/Users/teamcity2/buildAgent/work/7c4fade2802b7783/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:64)
	at io.kotest.property.Gen#minIterations(/Users/runner/work/kotest/kotest/kotest-property/src/commonMain/kotlin/io/kotest/property/Gen.kt:63)
s
I think you were on the right lines about it somehow generating a null
is optics doing anything funky with the compiler ?
s
Nope, there is a
kapt
module but I have it disabled so it cannot interfere
s
I've pushed that change
s
Thanks, I’ll test it after it build
s
I've invited you to the kotest org with full write permissions. Any changes to master automatically result in a snapshot build. I'm out from tomorrow night to the follow Tuesday. I'll be on slack for discussions but if you need to make small changes like this to the project you can, and you can get a new build out of it.
🙏 1
s
Thank you Sam! We’re very close now, so we hopefully cut M1 when you get back.
Or make it green tonight 😄
s
I will cut kotest 5 m1 tonight
s
Hey @sam,
Gen#generate
has the same problem. Shall I turn them into
abstract fun
?
s
I guess it won't break the contract for anyone right ?
They couldn't override it as its a sealed class
so yeah I think that's fine
s
Actually I’m not sure about that..
Arb
is
abstract
so it’s open, right?
s
yes
s
Okay, I think I found what was causing the
null
bug and I think I fixed it from my side
s
was it something obvious ?
s
When I think about it again it doesn’t make sense that
this
is
null
inside
Gen
because you call it on the instance
s
yes that is a good point
s
Not really, I noticed that I had some
val x: Arb<A>
and in that’s the only module that does it
s
do you know what the cause was
s
When I rewrote them to
fun Arb.Companion
they were properly initialised
s
oh odd
s
Maybe something with concurrency on native?
Are the tests being run on KotlinX Dispatchers.Default or?
s
hmmm not sure
s
To what is Kotest delegating the tests?
s
native is just run blocking right now
I have a ticket to do something smarter later
but it's just about getting it working for now
s
Found some more Kotlin Native compiler bugs in Arrow. lambda references for properties called
value
don’t seem to work. I had to remove two usage like that in 2 different modules same compiler bug
s
oh interesting
s
Native is green for all modules
Only left is figure out why JS hangs on STM
I’m not sure what is going on in Arrow Fx STM O.O It seems to be exploding somehow. I suspect this is due to compiler bug actually, and somehow it’s looping and it keeps adding tests or something.
It’s fully of duplicated tests like this, and it says it ran 50k+ tests and there is only like ~150 tests in that module.
It’s probably the most complex module in terms of low-level coroutines usage though, to allow for transactional operations through suspension.
s
Turn on compiler verbose mode
See what the js plugin is finding
s
You just add
--verbose
to Kotlin Compiler settings in IDEA and check the
build
window?
s
I set it in gradle
👍 1
Copy code
targets.all {
      compilations.all {
         kotlinOptions {
            verbose = true
         }
      }
   }
inside the kotlin block
s
mind blown
Not sure what to look at with
--verbose
😅
s
The actual compiler output
before the tests start, the kotest js compiler plugin will run as the test code compiles
and it will output how many specs it found
This is native but shows you the idea:
Copy code
> Task :compileTestKotlinLinuxX64
v: Using Kotlin home directory dist/kotlinc
w: Installing SpecIrGenerationExtension
w: BitstringTest.kt contains 1
w: SsnTest.kt contains 1
w: ThrowableTest.kt contains 1
w: Detected 3 native specs:
w: BitstringTest
w: SsnTest
w: ThrowableTest
I am wondering if the plugin is generating all these tests
s
Okay, let me check that output. Thanks 👍 I am actually suspecting that something is going majorly wrong in JS compiler, and it somehow captures the
"…" { }
invocation into
atomically
from STM which loops and is thus adding
n
tests for
n
retries in STM 😕 I am also trying
1.5.30-RC
which has JS IR in Beta
s
Seems more likely to be the IR compiler. The IR team have been very helpful when I've spoken to them.
👍 1
s
In what channel did you get in touch with them?
s
privately
s
Any idea how we can keep
JS(BOTH)
without breaking the
build
command?
s
does build execute test ?
s
It fails saying that it cannot resolve the dependencies for legacy