mutant
mutant copied to clipboard
mapping tests to code lines
covr does not have the ability to produce this mapping. if desired, we'd need to build this ourselves. possibly like
test_file = "tests/testthat/test-geo_linestring.R"
x = covr::file_coverage("R/geo_linestring.R", test_file)
df = covr::tally_coverage(x)
df$test_file = basename(test_file)
# some lines below deleted for brevity
#> filename functions line value test_file
#> 1 R/geo_linestring.R geo_linestring 23 1 test-geo_linestring.R
#> 6 R/geo_linestring.R geo_linestring 28 0 test-geo_linestring.R
#> 11 R/geo_linestring.R geo_linestring 34 1 test-geo_linestring.R
#> 12 R/geo_linestring.R geo_linestring 36 1 test-geo_linestring.R
#> 13 R/geo_linestring.R geo_linestring 37 9 test-geo_linestring.R
#> 19 R/geo_linestring.R initial_bearing 49 9 test-geo_linestring.R
#> 21 R/geo_linestring.R initial_bearing 51 9 test-geo_linestring.R
#> 25 R/geo_linestring.R final_bearing 58 9 test-geo_linestring.R
#> 26 R/geo_linestring.R final_bearing 59 9 test-geo_linestring.R
then at least we can only run certain test files (e.g., test-geo_linestring.R) we know are testing lines in which a mutation is located
don't think there's any way to just run specific test_that blocks within test files, and probably not a good idea anyway since there could be setup stuff we miss
maëlle mentioned https://yonicd.github.io/covrpage/articles/get-started.html might have something useful