Can't show the code coverage map - Answered

I used

sui move test --coverage --test

to generate the .coverage_map.mvcov
When I want to show the map with

sui move coverage source --module vote

I get the error

error[E03002]: unbound module
   ┌─ ./sources/vote.move:82:12
82 │     friend vote::vote_tests;
   │            ^^^^^^^^^^^^^^^^^^^^ Unbound module 'vote::vote_tests'

when using

sui move coverage source --module vote --test

I get the error:

(base) ➜  move git:(main) ✗ sui move coverage source --module vote --test 
thread 'main' panicked at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/str/
byte index 4294967206 is out of bounds of `;`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    709844 IOT instruction (core dumped)  sui move coverage source --module vote --test
1 Like

Removing the line

friend vote::vote_tests;

and using

sui move coverage source --module vote

But why can’t I get it working with keeping this line?

1 Like

Adding a test_only was required to remove the unbound error.

    friend vote::vote_tests;
1 Like

Hi! If you can throw together a minimal example of the source that triggers this we can look into it further, in case it’s not expected. If it’s expected to add #[test_only], maybe we can add more helpful error messages when running the coverage command.

1 Like

The ‘vote_tests’ module was indeed under a tests folder.
The unbound module error was key, a ‘sui move build’, ‘sui move prove’ also failed to work I figured out later.
The issue in the end had not much to do with the coverage map.

1 Like