Can anyone help me figure out what’s happening here?
I have a test case in my project which behaves differently from sbt command line vs from called within IntelliJ.
test("reflect.getSubTypesOf"){
val reflect = new org.reflections.Reflections()
assert(reflect.getSubTypesOf(classOf[List[Any]]).toArray.nonEmpty)
assert(reflect.getSubTypesOf(classOf[List[Any]]).toArray.contains(List(1,2,3).getClass))
assert(reflect.getSubTypesOf(classOf[List[Any]]).toArray.contains(List.empty.getClass))
}
When I run this test from the command line with sbt "testOnly genus.TypesTest" the test passes, but when I run this from within InteliJ, it fails
Array() was empty
ScalaTestFailureLocation: genus.TypesTest at (TypesTest.scala:91)
org.scalatest.exceptions.TestFailedException: Array() was empty
at org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
This is everso curious. I tried running the tests in VScode, and they work. Now, when I retry them in IntelliJ they magically work.
Bizzare. My guess is that the Reflections library try to scan the project and there was something wrong with the project directory structure related to my recently copying the repository and changing its name. I’m guessing that opening the project in VSCode/Metals, repaired the problem.