zio / zio-intellij

A companion IntelliJ IDEA plugin for the ZIO library ecosystem.
Apache License 2.0
212 stars 40 forks source link

Test results cut off part of test name #468

Closed disordered closed 5 months ago

disordered commented 5 months ago

This is in zio-test v2, did not test with v1.

Below code will cut of part of test name in the viewer:

suiteAll("Service") {
  suiteAll("update") {
    test("updates to everyone's satisfaction") {
      ZIO.succeed(assertTrue(true))
    }
  }
}

will render as:

Service
  update
    s to everyone's satisfaction

sbt test will render as:

+ Service
  + update
    + updates to everyone's satisfaction
hmemcpy commented 5 months ago

Ugh. Thanks, I'll take a look!

hmemcpy commented 5 months ago

I was just able to reproduce this. It seems that the text is reported correctly from the runner, I suspect it's an IntelliJ bug, trying to build a nested test tree, so it cuts the word update from updates for some reason. I'll see if I can fix it in the plugin, otherwise I'll report it as an IntelliJ issue.

Thanks for reporting!

hmemcpy commented 5 months ago

Update: it seems to be the default behavior of IntelliJ's test tree builder. It has some logic where it tries to group nested suite tests and looks up a parent, then does an equivalent of

if (test.name.startsWith(parent.name)) test.name.substring(parent.name.length())

And so far it doesn't seem to be a way to (easily) interfere with this behavior. I'm not giving up :)

disordered commented 5 months ago

It's not a big deal if you can't fix it, I just ended up rewording the test to avoid it. Obviously, would be nice if this could be fixed.

Thanks for looking into it, either way.

hmemcpy commented 5 months ago

Hah, yeah it's one of those crazy things IntelliJ does... I'm sure they had their reasons :) Anyway, thanks for reporting! I don't really see an easy way to fix this right now (everything down there is pretty much hardcoded/final, so I can't hook into the "presentable name" logic). I'm closing this for now.