metals icon indicating copy to clipboard operation
metals copied to clipboard

fix: pass the environment variables from the BSP server when running tests

Open arturaz opened this issue 7 months ago • 1 comments

Fixes https://github.com/com-lihaoyi/mill/issues/5039.

Metals has two code paths for running tests, one where the build server provides debugging support and another where it does not. Mill does not provide the debug support.

Now Metals correctly:

  • invokes either buildTarget/jvmRunEnvironment or buildTarget/jvmTestEnvironment BSP commands.
  • actually uses the environment variables from those (previously only the classpath was used)

arturaz avatar Jun 05 '25 16:06 arturaz

You should also run sbt scalafixAll.

kasiaMarek avatar Jun 06 '25 13:06 kasiaMarek

This should be ready for merging now.

arturaz avatar Jun 22 '25 07:06 arturaz

CI run failed (https://github.com/scalameta/metals/actions/runs/15799102190/job/44613791634?pr=7544#step:5:26417), but I can't find the actual error and locally the tests run just fine for me:

tests.mill.MillLspSuite:
  + basic 36.725s
  + new-dependency 41.994s
  + error 43.453s
  + fatal-warnings 31.596s
Execution took 2m33s
4 tests, 4 passed
All tests in tests.mill.MillLspSuite passed

================================================================================
Total duration: 2m33s
All 1 test suites passed.
================================================================================

Can someone help me pinpoint the issue?

arturaz avatar Jun 24 '25 15:06 arturaz

Can someone help me pinpoint the issue?

It might be flaky, the Mill tests somehow are. Let's see if they pass now

tgodzik avatar Jun 24 '25 15:06 tgodzik

It might be flaky, the Mill tests somehow are. Let's see if they pass now

It seems an unrelated test now failed due to flakyness. Can we get this PR merged?

arturaz avatar Jun 25 '25 08:06 arturaz