How can I generate coverage.json without using an embedded project?
#53
|
I’m trying to create a embedded-runner collect coverage.jsonHowever, that doesn’t apply to my project. I’ve tried the following workflow instead: cargo install mantra
cargo clean
cargo llvm-cov test
cargo llvm-cov report --json > coverage-report.json
mantra collect mantra.tomlMy [coverage]
files = ["coverage-report.json"]When I run '79' requirements kept.
'2' traces kept.
Failed to update coverage data. Cause: missing field `test_runs` at line 1 column 32168419It seems that So the question is: How can I generate a compatible |
Replies: 1 comment 2 replies
|
Hi, Getting test and coverage data in a format mantra understands is unfortunately a bit tricky at the moment. You need to follow the JSON schema defined by the struct here https://github.com/mhatzl/mantra/blob/main/schema/src/coverage.rs It is not just taking code coverage, but also test output. That's why you see "test-run" in your error. I am working on a new mantra version that will be able to take in JUnit and Cobertura formats. This will allow you to use cargo-nextest and llvm-cov/grcov. Hopefully I have this ready in a few months. Until then, you can try to convert your data to fit the current schema. |
Hi,
thanks for checking out mantra.
Getting test and coverage data in a format mantra understands is unfortunately a bit tricky at the moment. You need to follow the JSON schema defined by the struct here https://github.com/mhatzl/mantra/blob/main/schema/src/coverage.rs
It is not just taking code coverage, but also test output. That's why you see "test-run" in your error.
I am working on a new mantra version that will be able to take in JUnit and Cobertura formats. This will allow you to use cargo-nextest and llvm-cov/grcov. Hopefully I have this ready in a few months. Until then, you can try to convert your data to fit the current schema.