Skip to content
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

Run with coverage #317

Open
tinder-fren opened this issue Oct 13, 2017 · 1 comment
Open

Run with coverage #317

tinder-fren opened this issue Oct 13, 2017 · 1 comment

Comments

@tinder-fren
Copy link

tinder-fren commented Oct 13, 2017

Thanks for the work on this plugin I am able to run tests within Intellij.

Any instructions on how to Run with Coverage work right within Intellij?

I tried to run with coverage, it seems finished the tests quickly but then always throw this error message when opening the "Coverage" window in Intellij.

Error:Internal error: (com.twitter.intellij.pants.PantsException) This is a Pants project. Please use PantsCompile under `Edit Configuration`
com.twitter.intellij.pants.PantsException: This is a Pants project. Please use PantsCompile under `Edit Configuration`
at com.twitter.intellij.pants.jps.incremental.serialization.PantsJpsProjectExtensionSerializer.loadExtension(PantsJpsProjectExtensionSerializer.java:28)
at com.twitter.intellij.pants.jps.incremental.serialization.PantsJpsProjectExtensionSerializer.loadExtension(PantsJpsProjectExtensionSerializer.java:14)
at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadComponents(JpsLoaderBase.java:62)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadFromDirectory(JpsProjectLoader.java:124)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject(JpsProjectLoader.java:101)
at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel(JpsSerializationManagerImpl.java:41)
at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel(JpsModelLoaderImpl.java:45)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:79)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:267)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Would really be handy to show what is not covered by unit test this way compare with doing it on command line like ./pants test bla: --test-junit-coverage-open.

I am using latest intellij(2017.2) and latest version of this plugin.

@wisechengyi
Copy link
Collaborator

wisechengyi commented Oct 13, 2017

Hi @tinder-fren

Thanks for reporting. In short, no, but maybe soon depending on how much community effort is available.

Reasons are:

  1. currently pants coverage uses cobertura, and iirc due to licensing issues, intellij cannot use it.
The code coverage measuring can be performed using the following runners:

IntelliJ IDEA code coverage runner (recommended).
EMMA open-source toolkit. Note that EMMA is not supported by the author any more, and works with Java 7 only when frame validation turned off (pass -noverify to the process).
JaCoCo.

from https://www.jetbrains.com/help/idea/code-coverage.html

There are recent effort trying to bring jacoco into pants pantsbuild/pants#4881, but afaict the actual jacoco related code isn't there yet.

  1. Since intellij project pants project delegates everything to pants, so the plumbing to get the report from pants to intellij is still todo. Also depending on whether there are such api available from the intellij coverage side.

  2. the stacktrace above is related to intellij trying to run its own compilation instead of Pants, and we have guard to prevent it.

Let me know if you would like to contribute to any aspect of the tooling, I'll be glad to help.

Thanks,
Yi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants