使用堆栈生成覆盖率报告
Generate coverage report with stack
我想使用 Stack 生成代码覆盖率报告。我 运行 命令
相当于(省略通过 --test-arguments
传递给测试套件的选项):
$ stack test --coverage
这将执行测试,然后输出以下内容:
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.
我认为应该(这会创建空报告)。 GHC 选项是相同的
我包裹的所有组件。不需要测试套件来重建
图书馆。毕竟,如果 Cabal 可以生成报告,Stack 应该可以
在给定相同的 Cabal 配置的情况下执行此操作还是我弄错了?
我打开了
an issue on 堆栈
GitHub 按照建议回购。
过了一会儿,我决定创建一个好的旧沙箱并生成报告
改用 Cabal(我真的需要看报告,你知道的)。 有效
以前,但现在我得到:
$ 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"]
什么?虽然我生成了很多报告,但我从未见过这个
前。上面有人刚刚决定我今天不会收到那份报告,
好像。
你知道如何使用 Stack 生成覆盖率报告吗?有没有人
成功了吗?
上游最近的更改修复了它。应该为 0.1.7.0 及更高版本的用户解决。
就我而言,我仍然收到此错误。 运行:
stack clean
stack test --coverage
解决了问题,据报道 here。
我想使用 Stack 生成代码覆盖率报告。我 运行 命令
相当于(省略通过 --test-arguments
传递给测试套件的选项):
$ stack test --coverage
这将执行测试,然后输出以下内容:
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.
我认为应该(这会创建空报告)。 GHC 选项是相同的 我包裹的所有组件。不需要测试套件来重建 图书馆。毕竟,如果 Cabal 可以生成报告,Stack 应该可以 在给定相同的 Cabal 配置的情况下执行此操作还是我弄错了?
我打开了 an issue on 堆栈 GitHub 按照建议回购。
过了一会儿,我决定创建一个好的旧沙箱并生成报告 改用 Cabal(我真的需要看报告,你知道的)。 有效 以前,但现在我得到:
$ 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"]
什么?虽然我生成了很多报告,但我从未见过这个 前。上面有人刚刚决定我今天不会收到那份报告, 好像。
你知道如何使用 Stack 生成覆盖率报告吗?有没有人 成功了吗?
上游最近的更改修复了它。应该为 0.1.7.0 及更高版本的用户解决。
就我而言,我仍然收到此错误。 运行:
stack clean
stack test --coverage
解决了问题,据报道 here。