VirtusLab / scala-cli

Scala CLI is a command-line tool to interact with the Scala language. It lets you compile, run, test, and package your Scala code (and more!)
https://scala-cli.virtuslab.org
Apache License 2.0
550 stars 129 forks source link

Getting Started Test Example Fails in Metals #2686

Open bnjmnbrmn-work opened 9 months ago

bnjmnbrmn-work commented 9 months ago

scala-cli: 1.1.1 scala: 3.3.1 VS Code Metals Extension last updated: 2024-01-13, 08:13:26 (can't seem to find a version number).

Following along with https://scala-cli.virtuslab.org/docs/getting_started, everything works until I try to run the test directly in Metals ( https://scala-cli.virtuslab.org/docs/getting_started#:~:text=directly%20within%20Metals ). The test passes when run from the command line, but when run from Metals (by selecting the "test" lens in VS Code) the test fails:

scala-cli-getting-started/files.test.scala:7
6:    val obtained = filesByExtension("scala").map(_.last).toSet
7:    assertEquals(obtained, expected)
8:  }
values are not the same
=> Obtained
Set()
=> Diff (- obtained, + expected)
-Set()
+Set(
+  "files.scala",
+  "files.test.scala"
+)

I added java.nio.file.Paths.get("").toAbsolutePath(), as in https://github.com/VirtusLab/scala-cli/issues/1483, and it looks like we (again) are executing in the {project-root}/.scala-build directory.

Notes:

Cool project, btw. I like it enough that I'm writing my first bug report on github here. Please let me know if you need any more details, and thanks for all the great work!

Gedochao commented 9 months ago

Hey, thanks for raising this! It seems strictly like a Metals bug, so let's track this under https://github.com/scalameta/metals/issues/6024 I will leave this issue open for now, in case there's any follow-up to be done on Scala CLI side.