Fix truncated messages at the end of test runs - #682
Merged
Conversation
lydell
force-pushed
the
fix-truncated-messages
branch
from
August 1, 2026 11:47
c0fd040 to
1ab6a3b
Compare
lydell
force-pushed
the
fix-truncated-messages
branch
3 times, most recently
from
August 1, 2026 16:46
3f3016e to
b285cfb
Compare
lydell
force-pushed
the
fix-truncated-messages
branch
from
August 1, 2026 16:48
b285cfb to
efd8fb9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that when running a big test suite with intellij-elm, a successful test run wasn’t reported as successful, but as “Terminated”. I first thought this was a bug in intellij-elm, but it turned out to be a bug in node-test-runner.
The reason some tests were marked as “Terminated” was because they never got their
"testCompleted"message. intellij-elm then interprets this as the test never finished and was terminated. What actually happened was that those test did complete, and node-test-runner did print the messages, but it then exited the process before everything had time to flush. This is a classic gotcha in Node.js: If you doconsole.log(somethingLong); process.exit(0);thensomethingLongcan be truncated mid-way.Each worker buffers test successes and sends them in batches in order to optimize for the fewest IPC messages. For a successful test run, it means that each worker sends one, single, big batch of
"testCompleted"at the end, once the worker has finished running all its tests. The main process then prints all of those and exits.This PR fixes this issue by using the approach usually recommended in this case:
console.log(somethingLong); process.exitCode = 0;. Instead of exiting the process explicitly and forcefully, we let it exit by itself once the event loop runs out. This required explicitly closing theserverin Supervisor.js (otherwise it kept on listening forever), and terminating theworker_threadsworker used to make synchronous HTTP requests forelm-solve-deps-wasm. The latter one was a “hidden dependency,” so it required a bit more work. I now pass it down all the way from the top, making it easy to know when to clean it up.I have tested this with the big test suite and intellij-elm: With this PR applied the test suite is marked as successful, not “Terminated”.
I went through all the place we call
process.exit. Most of them do so after printing something short, so I didn’t touch them, because I didn’t want to risk the process not exiting in those case due to something not being shut down. The only other place I found that we might print something long before exiting iselm-test make, so I updated that to use theprocess.exitCodestrategy as well (forelm makeerrors, not unknown errors).