-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No test instrumentation with Scala 3.2.1, ZIO 2.0.4 and ZIO Test #458
Comments
Hey @longliveenduro do you still have this issue using the latest sbt-scoverage? If so could you provide a minimal project for me to reproduce this? |
Thanks @ckipp01 for coming back to this.
|
Sorry it took so long to get back to this @longliveenduro . Looking closer I have a feeling that whatever is impacting scala/scala3#15791 is the same issue here. Looking through what's generated in the
This looks to be actually instrumenting some macro code inside of tapir. And then related to the error you're seeing:
This also shouldn't be implemented. Feel free to create a report for this inside of the Dotty repo as it will need to be fixed there. I'm not 100% sure it is the same as the one I listed so feel free to just create a new one and then leave it up to them to mark it as a duplicate or not. |
I'm preparing a PR to dotty with coverage bugfixes, it will hopefully fix this issue :) |
@TheElectronWill I upgraded to Scala 3.2.1 and sbt scoverage to 2.0.5 on https://github.com/longliveenduro/zio-geolocation-tapir-tapir-starter. And still the same error occurs |
Ah! I should add something on the sbt-coverage side then. Thanks for warning me :) |
Thank you very much for your effort. Just realized that sbt-scoverage 2.0.6 is already out. Updated my example to reproduce the problem. |
FYI: in our closed source code we have now this when using sbt coverage test:
Works without sbt coverage (i.e. sbt test only) There is only one change that caused this to occur now: Before (test runs were working but still got coverage error from this thread):
After (test runs get the 'Error exists in the bytecode' from above):
So just remove the trait "RefinedTypes" and using it as an object directly. |
@TheElectronWill adjusted my example to reproduce the above "Error exists in bytecode". sbt clean test works. |
Thanks for the example! It will help me track the root cause of this issue. |
After upgrading to scala |
Ah thank you very much. How do I find out in which release it lands/landed? |
In the description of the Github release you'll find the list of improvements. https://github.com/lampepfl/dotty/releases/tag/3.2.2-RC1 |
@TheElectronWill Just tested RC1. Works great, many thanks! |
Hi again @TheElectronWill, just checked the overall coverage statement coverage of my ZIO2 + Scala 3 project. And I was surprised how low the number was. So i drilled into the HTML coverage reports and added a logging statement to make sure this part of the code is executed during the test. Result is, that the coverage report shows it as untested, but I can see the log statement during the tests. The whole for comprehension shows red (untested) in the HTML report:
But on the console (running the tests) I can see:
|
Hi! With code coverage instrumentation enabled, the compiler generates
Does the for comprehension, or at least a part of it (like a method call to flatMap, ZIO.attempt, etc.) show up in your coverage files? Depending on what the .scoverage file contains, we should open an issue either here or on Dotty. I suspect that complex |
Thanks for your answer! |
Hi @TheElectronWill. I upated my example at https://github.com/longliveenduro/zio-geolocation-tapir-tapir-starter to use Scala 3.2.2-RC1. I also updated sbt, plugins and dependencies. If you let the coverage report run on this example, there are no E.g. Anyways, the test calls e.g. the "hello" endpoint and thus must go over the above "Hello ...". |
I'll take a look, thanks! If you compile with |
No, this is where it should spit them. |
@TheElectronWill @ckipp01 Thanks for the infos, but looking at these files I am a bit lost. I see some problems with the coverage report for my example project https://github.com/longliveenduro/zio-geolocation-tapir-tapir-starter. It is not only the for comprehension but e.g. also this section is marked red/untested:
which is obviously covered by EndpointSpec. |
I got the same error, went to 3.2.2-RC1 and I no longer see the error. But It's no longer doing coverage properly, my project went from 86% to 49%. I think it's not aggregating the different modules the same. |
Not sure if there's any relation to this issue: #382 The original issue is quite old - but I have added some examples below where coverage was expected but not reported. |
I tested Scala 3.2.2 and 3.3.0-RC2. Coverage plugin is working, but the numbers are not correct (too low). |
I do not see that ZIO specs are instrumented:
The text was updated successfully, but these errors were encountered: