https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
g

GarouDan

03/29/2019, 4:49 PM
Hi buddies, I’m working on a project that uses a
js
,
jvm
and
native
targets. The strange thing is I cannot make the js tests fail, it looks it is being ignored. Does someone had a problem like this or knows an workaround? This is very strange.
i

ian.shaun.thomas

03/29/2019, 4:50 PM
how are you running js tests?
k

kpgalligan

03/29/2019, 4:51 PM
JS tests don’t run automatically. You need to configure them to run, AFAIK
g

GarouDan

03/29/2019, 4:52 PM
I’m running with something like:
./gradlew jvmTest
but
./gradlew jsTest
never fails, even changing the code. I can make the jvm fail.
@kpgalligan, what do you mean, how can I do that?
k

kpgalligan

03/29/2019, 4:53 PM
I don’t know. I just know they don’t run out of the box. There are others here who focus a lot more on JS and I’m sure can explain it better.
i

ian.shaun.thomas

03/29/2019, 4:54 PM
a few ways but one of the simple ways is to use one of the plugins to aid in this such as: https://github.com/SalomonBrys/Kotlin-JS-Gradle-Utils
granted a plugin is not a requirement, it just simplifies the process as the MPP plugin does not really have an opinion on how to run JS tests yet. Hopefully in the future they shortcut some common ways to run JS tests so we don't need to depend on so much manual config/or 3rd party utilities.
g

GarouDan

03/29/2019, 4:58 PM
Hum, interesting. Thanks @ian.shaun.thomas. I’ll make an attempt here.
r

russhwolf

03/29/2019, 5:06 PM
I think the position of the Kotlin team last I recall was that they didn't want to take a position on what to use as the default js test framework (mocha, jest, etc) so they leave it to you to decide what you want to use.
g

GarouDan

03/29/2019, 5:09 PM
o.O
I’ve tried here and it works. But I’ve received a warning like the following:
Copy code
npm WARN saveError ENOENT: no such file or directory, open '/path.../build/test-js/js/package.json'
I’ve seen the plugin has created the package-lock.json but not the actual package.json.
i

ian.shaun.thomas

03/29/2019, 5:10 PM
yeah I am glad they aren't overly opinionated on the topic personally. I wouldn't mind if they made a more formal testing utility for JS even if it lived outside the core plugin
you can use this project as an implementation example https://github.com/ToxicBakery/Arbor
g

GarouDan

03/29/2019, 5:11 PM
Either way, I think the kotlin team could let us choose the test framework like this plugin did, would not be a problem, but not giving an option to execute the tests isn’t too good.
h

h0tk3y

03/29/2019, 5:49 PM
By the way, a JS test runner that will work by default for the JS targets is on the way and will be released with Kotlin 1.3.40.
🍾 1
🎉 6
a

ankushg

03/29/2019, 6:33 PM
@h0tk3y is there a YouTrack issue for this I can follow? Just want to make sure I don't miss it 🙂
3 Views