Skip to content

Getting Started Test Example Fails in Metals #2686

Open
@bnjmnbrmn-work

Description

@bnjmnbrmn-work

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 #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.scala and 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    IDEbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions