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

elm-test-rs --watch sometimes gives a _Debug_crash #130

Open
yarrow opened this issue Oct 7, 2023 · 3 comments
Open

elm-test-rs --watch sometimes gives a _Debug_crash #130

yarrow opened this issue Oct 7, 2023 · 3 comments

Comments

@yarrow
Copy link

yarrow commented Oct 7, 2023

When I save a file after a change, I fairly frequently get a crash message from elm-test-rs --watch instead of test output. The workaround is just to save again — elm-test-rs recovers and runs the tests as expected.

I may well have done something wonky in my setup — I'm pretty new to Elm, and very new to elm-test-rs, Lamdera, and Elm Land, which I'm trying to use together.

Here's an example crash message:

Change detected in tests/Tests.elm
==================================





node:internal/event_target:1083
  process.nextTick(() => { throw err; });
                           ^
Error: TODO in module `Runner` on line 33

The regex for replacing this Debug.todo with some real code must have failed since you see this message!

Please report this bug: https://github.com/mpizenberg/elm-test-rs/issues/new

    at _Debug_crash (/Users/yarrow/elm/convergence/elm-stuff/tests-0.19.1/js/Runner.elm.js:498:10)
    at /Users/yarrow/elm/convergence/elm-stuff/tests-0.19.1/js/Runner.elm.js:254:3
    at $author$project$Runner$checkHelperReplaceMe___ (/Users/yarrow/elm/convergence/elm-stuff/tests-0.19.1/js/Runner.elm.js:3325:5)
    at /Users/yarrow/elm/convergence/elm-stuff/tests-0.19.1/js/Runner.elm.js:3990:4
    at Object.<anonymous> (/Users/yarrow/elm/convergence/elm-stuff/tests-0.19.1/js/Runner.elm.js:5194:5)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:326:10)
    at [kOnMessage] (node:internal/worker:337:37)
    at MessagePort.<anonymous> (node:internal/worker:232:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Node.js v20.8.0
@lydell
Copy link
Contributor

lydell commented Oct 7, 2023

This happened a couple of times in a row for me with elm-test --watch (note: not elm-test-rs), but then the next day I couldn’t reproduce it and haven’t been able to since. Spooky.

@mpizenberg
Copy link
Owner

mpizenberg commented Oct 7, 2023 via email

@yarrow
Copy link
Author

yarrow commented Oct 7, 2023

The regex looks fine. I suspect thatkernel_patch_tests isn't being executed, since Runner.elm.js also doesn't have console.log changed to console.elmlog after a crash.

I was lucky enough to see a crash while running with -vvv, and did get a log message Kernel-patching Runner.elm.js before the crash. Currently that log happens just before the attempt to read from compiled_runner, so maybe the read fails sometimes? It's I/O, so there could be some kind of weird data race happening.

I've compiled a version that adds a Reading Runner.elm.js before the read and moved Kernel-patching Runner.elm.js into the kernel_patch_tests function.

Of course, now I'm not getting crashes! I'll keep working on my project with the altered logging and -vvv and keep my fingers crossed for more information.

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

3 participants