scala-cli
scala-cli copied to clipboard
Getting Started Test Example Fails in Metals
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:
- I observed the same behavior with Emacs+Metals+
lsp-mode - If I add a main method to
files.scalaand execute from VS Code,java.nio.file.Paths.get("").toAbsolutePath()gives{project-root}.
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!
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.