Generate coverage report with stack

Mark Karpov

I want to generate code coverage report using Stack. I run command that amounts to (omitting options passed to test suite via --test-arguments):

$ stack test --coverage

This performs the testing and then outputs the following:

Error: The coverage report for myproject's test-suite "tests" did not consider any code. One possible cause of this is if your test-suite builds the library code (see stack issue #1008). It may also indicate a bug in stack or the hpc program. Please report this issue if you think your coverage report should have meaningful results.

I think it should (this creates empty report). GHC options are identical for all components of my package. There is no need for test suite to rebuild the library. After all, if Cabal can generate the report, Stack should be able to do it given the same Cabal config or am I mistaken?

I've opened an issue on Stack GitHub repo as suggested.


After a while I decided to create good old sandbox and generate the report using Cabal instead (I really need to see the report, you know). It worked previously, but now I get:

$ cabal sandbox init
… <everything OK>
$ cabal update
… <everything OK>
$ cabal install --only-dependencies --enable-tests
… <everything OK>
$ cabal configure --enable-tests --enable-coverage
… <everything OK>
$ cabal build
… <everything OK>
$ cabal test
Running 2 test suites...
Test suite tests: RUNNING...
Test suite tests: PASS
Test suite logged to: dist/test/myproject-0.1.0-tests.log
hpc: can not find HUnit_DDLSMCRs3jyLBDbJPCH01j/Test.HUnit.Lang in ["./.hpc","./dist/hpc/vanilla/mix/myproject-0.1.0","./dist/hpc/vanilla/mix/tests"]

What? I've never seen this, although I generated many reports before. Someone up there just decided that I won't get that report today, it seems.


Do you know how to generate coverage report using Stack? Has anyone succeeded at this?

Mark Karpov

Recent changes upstream fixed it. Should be resolved for users of 0.1.7.0 and later.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

phpunit generate coverage report in html format for specific folder only

From Dev

Generate html report from .coverage file

From Dev

AngularJS + Karma + Jasmine + Karma-Coverage: Empty coverage report

From Dev

Generate JUnit Test report

From Dev

Generate report in bash

From Dev

Visual Report for Code Coverage in Django

From Dev

Generate report and sort by date

From Dev

Maven Emma coverage Report failed

From Dev

Coverage report says zero coverage on android with gradle

From Dev

How to generate test coverage report in Meteor / Velocity?

From Dev

Exclude folder in jacoco coverage report

From Dev

GCovr generate a 0% coverage report, if cpp,gcno and gcda files are not present at same folder

From Dev

Jacoco Coverage and Report Task with Ant

From Dev

maven jacoco plugin does not generate coverage report

From Dev

Jacoco generate coverage report for only a single test class

From Dev

build.gradle with Jacoco plugin doesn't generate coverage report for integration tests

From Dev

How can I use pytest-cov to both generate a coverage report and also print to terminal?

From Dev

How to generate a weekly report?

From Dev

Generate a custom report with parameters

From Dev

Coverage report of multi module project

From Dev

Visual Report for Code Coverage in Django

From Dev

JaCoCo Debug Coverage Test Report

From Dev

Generate coverage report with stack

From Dev

Coverage report with istanbul and mocha

From Dev

Generate coverage with Mocha and Istanbul

From Dev

MUnit coverage report of Mule in Jenkins

From Dev

Generate a sorted report in Access

From Dev

Get coverage report without phpunit

From Dev

How to generate a detail report of functional coverage in Questasim?

Related Related

HotTag

Archive