I'm trying to run the tests in the Kotlin Multipla...
# javascript
e
I'm trying to run the tests in the Kotlin Multiplatform library tutorial: https://kotlinlang.org/docs/multiplatform-library.html#js The JS tests fail with:
ReferenceError: Buffer is not defined
I can reproduce it here: https://pl.kotl.in/AklbZ91yN How do I proceed to... • ... solve this issue locally? • ... report this reproducible bug?
t
AFAIK - Kotlin
Buffer
- alias for JS
ArrayBuffer
js("Buffer")
- why not
kotlin.Buffer
?
e
The Kotlin MPP example code uses this exactly, hence why 😉
t
Do you need
nodejs
target?
e
Apparently the tutorial uses this nodejs API, but it doesn't work
I don't need it, I just want the tutorial to work properly
t
On playground
browser
target used
Node - JS
Buffer
Browser - JS
ArrayBuffer
or
kotlin.Buffer
e
I understand where the issue comes from now
The tutorial assumes that you use a
nodejs
target, but if you follow the tutorial and create a project from scratch, you end up with a
browser
JS target
What I still don't understand is how to use
ArrayBuffer
or
kotlin.Buffer
, as I only can find https://kotlinlang.org/api/latest/jvm/stdlib/org.khronos.webgl/-array-buffer/ from the
org.khronos.webgl
package, which is likely not what you're referring to? And I can't find anything about
kotlin.Buffer
t
My bad - it was
Buffer
from Ktor IO (mixed with
kotlin.ByteArray
)
you end up with a 
browser
 JS target
Looks like an issue
e
Now merged and released! 🎉
🎉 1