https://kotlinlang.org logo
#javascript
Title
# javascript
r

Reuben Firmin

12/09/2023, 12:24 PM
Is it possible to get better IntelliJ support for kotlinjs tests as a small project on the roadmap? There are several bugs (https://youtrack.jetbrains.com/issue/KTIJ-27949, https://youtrack.jetbrains.com/issue/KTIJ-9304, https://youtrack.jetbrains.com/issue/KTIJ-27307/, arguably also https://youtrack.jetbrains.com/issue/KT-31799) that make quality of life worse (than Jest/Typescript, even)
a

Artem Kobzar

12/11/2023, 10:01 AM
For the quoted identifiers, could you please try to turn on
JsAllowInvalidCharsIdentifiersEscaping
language feature. You could do it by the next code in your `build.gradle.kts`:
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
    kotlinOptions {
        freeCompilerArgs += "-XXLanguage:+JsAllowInvalidCharsIdentifiersEscaping"
    }
}
Soon, it will be enabled by default
r

Reuben Firmin

12/12/2023, 2:52 PM
@Artem Kobzar thanks, that does resolve that issue. 🤞 the rest can be tackled soon - it's barely usable right now (there's not even test controls in test files - run/debug etc.)
e

Edoardo Luppi

12/12/2023, 3:40 PM
@Reuben Firmin to enable gutter icons you need to enable experimental multiplatform features via Settings.
r

Reuben Firmin

12/13/2023, 3:25 PM
thanks, that worked. here's another related ticket to get minimum functionality for kjs tests in place: https://youtrack.jetbrains.com/issue/KTIJ-15528
e

Edoardo Luppi

12/14/2023, 10:40 AM
I agree that JS test support could be improved, although I think the current state of things is pretty decent. I've yet to find myself in a situation where I can't test something.
r

Reuben Firmin

12/14/2023, 11:51 AM
I really disagree. debugging is broken, assertion comparison is broken, they don't have sourcesmaps, all tests run twice
it's true that you can launch tests and use printlin statements to figure out where something broke. but that's a terrible developer experience, compared to JVM or event typescript/jest
e

Edoardo Luppi

12/14/2023, 11:56 AM
Not my experience.
Debugging is broken
You mean you can't debug when running JS tests? If that's the case it's strange because I do it daily. It's true that coroutine heavy code sometimes fails to stop at breakpoints tho.
All tests run twice
This is just an IDE artifact, so you don't need to worry about double execution. Gradle will run them only once.
Don't have source maps
What's your use case for source maps during testing?
r

Reuben Firmin

12/14/2023, 11:57 AM
see all the linked tickets 🙂
e

Edoardo Luppi

12/14/2023, 12:00 PM
If it's for better stack traces, I can agree on that.
Related to debugging coroutine code, suspending functions, etc., use Force Step Over to avoid the debugger skipping breakpoints and going directly to the end of the execution.
r

Reuben Firmin

12/14/2023, 12:07 PM
that's helpful. though the issue i get is it hard crashing (27949). intellij support were able to repro