Thread
#reaktive
    Mina Eweida

    Mina Eweida

    2 years ago
    Hi @Arkadii Ivanov I have a question regarding the fix regarding javascript https://github.com/badoo/Reaktive/pull/486 When it gets approved and merged, when will you plan to release it?
    Arkadii Ivanov

    Arkadii Ivanov

    2 years ago
    Hey! I noticed some new commits. I will review them tomorrow. In general we need to get to the bottom before approval. A new version will be released right after merge.
    Reviewed the changes, please check
    Mina Eweida

    Mina Eweida

    2 years ago
    Sorry just seen your comment. I actually simplified the PR and removed the files I created. I will think of a test to run for js, pretty much this issue should have shown up if
    MainScheduler
    was running on a test, so I will just try to run a test using it and see if it crashes then will run it with my change and see
    The fix I just pushed works fine on my sample nodeJs app, note that it’s actually written in javascript not Kotlin so what I am doing is actually locally npm publishing my library’s package and Reaktive
    Actually my assumption did not work.
    @Test
        fun test_main_scheduler_subscription() {
            val emitted = 10
            val upstream = observable<Int> {
                it.onNext(emitted)
            }.subscribeOn(mainScheduler)
            upstream.subscribe {
                assertEquals(emitted, it)
            }
        }
    This tests works fine with both
    globalThis
    and
    window
    when running
    jsNodeTest
    😞
    Arkadii Ivanov

    Arkadii Ivanov

    2 years ago
    Hey, the following test fails with
    ReferenceError
    in current master:
    @Test
    fun submits_task_to_executor() {
        val scheduler = MainScheduler()
        val executor = scheduler.newExecutor()
        executor.submit {}
    }
    So if you could attach this to your PR that would be great!
    So the
    jsBrowserTest
    task passes but the
    jsNodeTest
    fails
    Mina Eweida

    Mina Eweida

    2 years ago
    Woww, thank you, it actually passed for me. I don’t get the difference though. I mean I used
    mainScheduler
    and subscription actually called
    submit
    in the
    mainScheduler
    and I was able to see it (I printed inside submit)
    Amended my commit
    Arkadii Ivanov

    Arkadii Ivanov

    2 years ago
    Perhaps in your case the error is handled by `
    reaktiveUncaughtErrorHandler
    which in JS just prints the error.
    Thanks
    Mina Eweida

    Mina Eweida

    2 years ago
    no it can’t because if it’s the case then why did my test pass, I mean it could be silently catching the exception but still I asserted on the emission
    technically it is posted so test might have ended before emission that’s why it showed that it passed
    Arkadii Ivanov

    Arkadii Ivanov

    2 years ago
    I mean in your case the subscription stage failed and the error was catched by the
    reaktiveUncaughtErrorHandler
    . The
    susbcribe{}
    was never called and so test passed.
    Mina Eweida

    Mina Eweida

    2 years ago
    yes makes sense
    Submitting 0
    [error] ReferenceError: window is not defined
    that was the case in fact 😄
    Arkadii Ivanov

    Arkadii Ivanov

    2 years ago
    Thanks for the PR!