Thread
#multiplatform
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    Has anybody had any luck getting JS unit tests running in Ubuntu? If I run allTests, in windows 10 I get JVM and JS test results, but in Ubuntu I only get the JVM side. (Using 1.3.50)
    s

    serebit

    3 years ago
    I don't have an Ubuntu machine (I'm a Solus man), but do you have the project handy? I can give it a run on Solus and see if it's distro-specific
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    I'm trying to get it to run in CI - it runs the correct tasks, but no reports are published for JShttps://cloud.drone.io/polyforest/acornui/106/1/2
    s

    serebit

    3 years ago
    Odd, I'm not seeing results for JS either when running
    ./gradlew check
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    I feel like this was working in 1.3.41 but I couldn't stay on 41 because it had IDE performance problems
    so I can't say for certain, I was only briefly on 41
    50 is fast though (thank goodness)
    For Linux I don't see kotlinNpmInstall anywhere in the build logs
    s

    serebit

    3 years ago
    Just ran it using 1.3.41 (specified via buildSrc) and still no JS results. Odd.
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    Are js tests running for you in other projects?
    s

    serebit

    3 years ago
    I intentionally avoid kotlin/JS 😛 but I can spin something up to test it locally
    corneil

    corneil

    3 years ago
    I've seen some weird stuff with Kotlin/JS try disabling incremental compilation
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    I don't think that's it, it happens in a fresh vm
    I want to hear from someone that has seen kotlin js unit tests run in linux 🙂
    Given that it's running fine but skipping js testing, I'm not entirely sure that the feature is supported yet..
    s

    serebit

    3 years ago
    I don't think it's skipping JS testing entirely, as it does generate output.bin files in
    build/test-results/browserTest/binary
    in a fresh Kotlin/JS project on 1.3.50
    but those files are empty, so it's entirely possible that the actual tests just aren't running, for whatever reason
    I think this is almost certainly a bug, and should be looked into
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    yeah, seems so, it's not doing the kotlin npm install stuff either
    trying on a mac
    s

    serebit

    3 years ago
    JB ostensibly uses Macs, so it probably works there 😛
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    unfortunately it's CI that I really want to work 🙂
    s

    serebit

    3 years ago
    Yeah, multiplatform has some CI hitches... Especially on Linux, seemingly. Kotlin/Native ships with an outdated version of the clang toolchain, which looks for
    libtinfo.so.5
    , which has been merged into
    libncurses
    for a while now
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    other than js tests it's been working pretty well for me overall.
    haven't tried kotlin native yet though
    or webasm
    yep, works on mac, just not linux
    will file a bug
    s

    serebit

    3 years ago
    :thumbsup_all:
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    thanks for help looking into it
    s

    serebit

    3 years ago
    No problem, happy to help!
    Arkadii Ivanov

    Arkadii Ivanov

    3 years ago
    I'm on Ubuntu and JS tests work for me. I mean if I add failing test then "check" task fails with reasonable output. Otherwise build successful.
    corneil

    corneil

    3 years ago
    Turns out my jsTest never executes!
    NO-SOURCE
    ?
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    @Arkadii Ivanov I think my problem is that in CI and my windows Ubuntu sub-system I don't have any browsers, so listing the browsers to test does nothing. What browser do you have listed in your test configuration?
    corneil

    corneil

    3 years ago
    add
    nodejs()
    did the thing for me
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    I will try that.
    I know that didn't work for me before, but I since changed to UMD module types instead of AMD, so that should theoretically work in NodeJS
    Hmm, interesting! The tests run now! They fail because of some dependencies on browser things, but I may be able to catch that for the js tests.
    corneil

    corneil

    3 years ago
    you need at least one of
    nodejs()
    or
    browsers()
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    That's what I was trying to say -- browser() works for mac and windows, not linux, but it may be because for linux it's CI or Ubuntu windows subsystem, which may not actually have any headless browsers that work with the tests
    corneil

    corneil

    3 years ago
    I think there is a chromium headless installation but it may still have dependencies not supported by WSL 1 it seems that WSL 2 will change that
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    It may be easier for me to get this running in nodejs than to get chromium headless installed in drone io
    I would like a headless js mode anyway - like I have a headless jvm mode
    corneil

    corneil

    3 years ago
    yes. getting unit testing in node with mpp is straight forward unless you need special bindings to node specifics.
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    yeah, I just need to check for things like window.navigator
    lol, the linux gods are spiting me... What the hell do I do to fix this? -????????? ? ? ? ? ? userInfo.kt
    it can't see a file I'm editing
    corneil

    corneil

    3 years ago
    Ouch
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    The tests are all running now under node! A couple oddities I wasn't expecting - In node the Intl date classes aren't responding to locale changes. - kotlinx serialization isn't working - NodeJS apparently does base64 encoding differently
    corneil

    corneil

    3 years ago
    base64?? That shouldn't?
    Nicholas Bilyk

    Nicholas Bilyk

    3 years ago
    in a browser it's window.btoa and window.atob, nodejs doesn't have a window
    a quick search suggests in node you're supposed to use 'Buffer'
    which doesn't exist in a browser.. so 😛
    W00t W00t
    I had to ignore the i18n tests in node, but other than that I got it all working. And Base64 stuff switches to use Buffer
    Thanks for the help. I might not have re-tried getting it to work in nodejs otehrwise.