Skip to content

Scala-cli doesn't output-coverage-out products. #1024

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

Closed
pikinier20 opened this issue May 19, 2022 · 3 comments
Closed

Scala-cli doesn't output-coverage-out products. #1024

pikinier20 opened this issue May 19, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@pikinier20
Copy link
Contributor

Version(s)
checked on 0.1.2 and 0.1.5

Describe the bug

After adding:

//> using options "-coverage-out:scoverage.coverage"

and running:

scala-cli compile -S 3.nightly .

scala-cli passes the option to compiler but the scoverage.coverage directory is not present neither in cwd nor in the .scala-build directory
To Reproduce
GoodCoverage.scala

//> using options "-coverage-out:scoverage.coverage"
object GoodCoverage {

  def sum(num1: Int, num2: Int) = {
    if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2
  }

}
scala-cli compile -S 3.nightly .

Expected behaviour
There should be a directory scoverage.coverage containing output from the compiler which is essential to check code coverage with e.g. scoverage.

@pikinier20 pikinier20 added the bug Something isn't working label May 19, 2022
@lwronski
Copy link
Contributor

Hi @pikinier20 , Thanks for reporting,
it seems that is also bloop issue as in #1023

There is exists a workaround and you have to use plain scalac without bloop. To disable using bloop you should use --server=false flag:

$ scala-cli compile -S 3.nightly . --server=false
$ ls
Hello.scala		scoverage.coverage

@lwronski
Copy link
Contributor

lwronski commented Jun 7, 2022

Hi @pikinier20,
Can you try to pass the absolute path to -coverage-out option? it should work when you pass the absolute path.

$ pwd
/tmp/scala-demo
$ cat Hello.scala 
//> using options "-coverage-out:/tmp/scala-demo/scoverage.coverage"
object GoodCoverage {

  def sum(num1: Int, num2: Int) = {
    if (0 == num1) num2 else if (0 == num2) num1 else num1 + num2
  }

}
$ scala-cli compile -S 3.nightly .
Compiling project (Scala 3.2.0-RC1-bin-20220606-cec9aa3-NIGHTLY, JVM)
Compiled project (Scala 3.2.0-RC1-bin-20220606-cec9aa3-NIGHTLY, JVM)
$ ls
Hello.scala		scoverage.coverage

@lwronski lwronski self-assigned this Jun 7, 2022
@lwronski
Copy link
Contributor

It should be fixed by #1080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants