Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapping tests to code lines #10

Open
sckott opened this issue May 18, 2020 · 1 comment
Open

mapping tests to code lines #10

sckott opened this issue May 18, 2020 · 1 comment
Labels
incremental related to incremental usage rather than all tests/all mutants

Comments

@sckott
Copy link
Owner

sckott commented May 18, 2020

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

@sckott sckott added the incremental related to incremental usage rather than all tests/all mutants label May 20, 2020
@sckott
Copy link
Owner Author

sckott commented May 20, 2020

maëlle mentioned https://yonicd.github.io/covrpage/articles/get-started.html might have something useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incremental related to incremental usage rather than all tests/all mutants
Projects
None yet
Development

No branches or pull requests

1 participant