scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.09k stars 330 forks source link

Dynamically defined tests (using ScalaTest) hang when ran from the IDE #6815

Open adamw opened 2 weeks ago

adamw commented 2 weeks ago

Describe the bug

Running the SourceOpsMapParTest tests from Ox never finishes. There's an endlessly spinning wheel:

image

In the debug console, I can see that the tests have finished:

===============================================
Total duration: 9.63s
All 1 test suites passed.
===============================================

Stopping the tests does nothing (using the square button on the right in the "test results" window). Sometimes this happens on the first test run, sometimes the first completes successfully, and only the second fails.

Moreover, quitting VS Code (which I'm using as the metals host) doesn't kill the Metals-started bloop.Server process. I have to manually kill it after I exit VS Code (which shuts down cleanly)

Expected behavior

  1. the tests are nicely reported in the "test results" window, or at least - not hang.
  2. existing VS Code cleans up any processes that have been started

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

1.3.5

Extra context or search terms

No response

adamw commented 1 week ago

In fact this happens from time to time on "normal" tests as well (using ScalaTest), although the class above is the best way to reproduce the problem

adamw commented 3 days ago

As a work-around, I found that while the "cancel test run" that appears in the bottom-right corner is basically a no-op, a bar (also used for debugging) at the top appears, with a red "stop", which does work.

Still, occasionally the tests hang, and when closing metals the bloop process remains, meaning that I have to periodically do a killall -9 java ;)