Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moleculeFlow with immediate recomposition mode errors on NodeJS #441

Open
kevincianfarini opened this issue May 5, 2024 · 0 comments
Open

Comments

@kevincianfarini
Copy link
Contributor

I introduced molecule as a way to test some library code which exposes a Composable function. In doing so, I exposed that molecule does not seem to be compatible with NodeJS while running tests. I get the following error:

io.github.kevincianfarini.monarch.StateOfTest.stateOf_starts_with_current_value[js, node] FAILED
    ReferenceError: window is not defined
        at <global>.sendFrame(/home/kevin/code/monarch/compose/build/compileSync/js/test/testDevelopmentExecutable/kotlin/js-ir/runtime/long.kt:27)
        at GatedFrameClock.protoOf.set_isRunning_m21k59(/Users/runner/work/molecule/molecule/molecule-runtime/src/commonMain/kotlin/app/cash/molecule/GatedFrameClock.kt:45)
        at slambda.protoOf.doResume_5yljmg(/Users/runner/work/molecule/molecule/molecule-runtime/src/commonMain/kotlin/app/cash/molecule/molecule.kt:80)
        at slambda.protoOf.invoke_d9fzmj(kotlin/molecule-molecule-runtime.js:459)
        at <global>.l(kotlin/molecule-molecule-runtime.js:543)
        at <global>.startUndispatchedOrReturn(/home/kevin/code/monarch/compose/build/compileSync/js/test/testDevelopmentExecutable/kotlin/js-ir/src/kotlin/coroutines_13/IntrinsicsJs.kt:99)
        at <global>.coroutineScope(/mnt/agent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/CoroutineScope.kt:261)
        at slambda.protoOf.doResume_5yljmg(/Users/runner/work/molecule/molecule/molecule-runtime/src/commonMain/kotlin/app/cash/molecule/molecule.kt:61)
        at slambda.protoOf.invoke_ilgcjr(kotlin/molecule-molecule-runtime.js:556)
        at SafeFlow.block(kotlin/molecule-molecule-runtime.js:603)
        at SafeFlow.protoOf.collectSafely_blptet(/mnt/agent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/flow/Builders.kt:57)
        at 3.protoOf.doResume_5yljmg(/mnt/agent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/flow/Flow.kt:226)
        at SafeFlow.protoOf.collect_aksokr(kotlin/kotlinx-coroutines-core.js:10079)

Is this expected behavior? I see that this repository declares JS targets that run tests on the browser, but should that preclude it from running on NodeJS? I've tried using both the Jetbrains Compose plugin while declaring molecule's runtime as implementation, and using the molecule plugin directly. Both produce the same results.

Here's a public reproducer sample: kevincianfarini/monarch@b1566e6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant