Code coverage not working
See original GitHub issueEnvironment
- IntelliJ Rust plugin version: 0.2.115.2157-193
- Rust toolchain version: rustc 1.41.0-nightly (710a362dc 2019-12-05)
- IDE name and version: CLion 2019.3.4
- Operating system: Linux Arch
- gcov: gcov (Arch Linux 9.2.1+20200130-2) 9.2.1 20200130
- lcov: LCOV version 1.14-6-g40580cd
- grcov: grcov 0.5.5
Problem description
Code coverage does not work
Steps to reproduce
Create a project with two files:
Cargo.toml
[package]
name = "rust-coverage-clion"
version = "0.1.0"
edition = "2018"
[dependencies]
lib.rs
fn sum(a: u32, b: u32) -> u32 {
dbg!((a, b));
a + b
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
assert_eq!(sum(2, 2), 4);
}
}
Add a run configuration “test” of type “Cargo command”, where command is “test”
Click on “Run ‘test’ with coverage”
CLion successfully build the project and launches test. Test results are visible (one test, it succeeds) and dbg!
output is shown as expected.
Code Coverage is not highlighted in the gutter.
Clicking “Run -> Show code coverage data” shows a window with a message “no coverage suites configured”
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Troubleshooting Code Coverage - Visual Studio (Windows)
Possible reasons for seeing no results or old results · Do you have the right edition of Visual Studio? · No tests were...
Read more >Code Coverage Not Showing In Editor - Apple Developer
I have turned on code coverage (before running my unit tests), and clicked on Editor > Show Code Coverage, but the editor does...
Read more >Code Coverage Results Window cannot be shown from Menu ...
The only way to open the Window is to to go Test Explorer, right click a test, and Analyze Code Coverage. After that...
Read more >Why does the Code Coverage not work in VS?
To analyze the code coverage of unit tests in Visual Studio you will typically select a set of tests and execute Analyse Code...
Read more >How to fix issue of code coverage not finding functions when ...
When running code coverage 4 fail due to functions being 'not defined'. They are defined (as the tests clearly show when they pass)....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The fix was to update
grcov
:Code coverage is not working for me with Rust plugin 0.3.143.3737-203 in CLion 2020.3.3. My project uses a cargo workspace. When I click the Coverage button, the tests run but the coverage screen does not appear.
I made these changes to the Run Configuration:
test --package package1
Now the coverage screen appears, but all files show 0 lines covered.
I filed an issue with JetBrains: https://youtrack.jetbrains.com/issue/CPP-24459