Map test files to potential issues
Source:R/MapTestFilesToPotentialIssues.R
MapTestFilesToPotentialIssues.RdIdentify potential issues for each test by matching commits that last
modified the test with commits that closed issues. Tests tagged with
#noissue are excluded from the results.
Usage
MapTestFilesToPotentialIssues(
dfFileTests = NULL,
strTestDir = "tests/testthat",
lglUseCoverage = FALSE,
dfIssueCommitsLong = NULL,
strOwner = GetGHOwner(strTestDir),
strRepo = GetGHRepo(strTestDir),
strGHToken = gh::gh_token()
)Arguments
- dfFileTests
(
data.frame) Atibble::tibble()with the structure returned byExtractTestsFromFiles().- strTestDir
(
length-1 character) Path to the directory containing test files. Defaults to"tests/testthat".- lglUseCoverage
(
length-1 logical) Whether to augment potential issues with source-line coverage. WhenTRUE,covr::environment_coverage()is used to discover issues from commits that touched source code exercised by each test. Requirescovrto be installed. Defaults toFALSE.- dfIssueCommitsLong
(
data.frameorNULL) Pre-computed issue-commit mappings fromMapLongIssueCommits(). IfNULL(the default), fetched automatically from the GitHub API. Provide this when callingMapTestFilesToPotentialIssues()multiple times to avoid redundant API requests.- strOwner
(
length-1 character) GitHub username or organization name.- strRepo
(
length-1 character) GitHub repository name.- strGHToken
(
length-1 character) GitHub token with permissions appropriate to the action being performed.
Value
A tibble::tibble() with columns:
Test: Thedescfield of the test fromtestthat::test_that().File: Path to the file where the test is defined, relative to the package root.Issues: List column containing integer vectors of issue numbers already tagged in the test description.PotentialIssues: List column containing integer vectors of issue numbers that might be related to each test based on commit history of the test (and of the functions exercised by the test, whenlglUseCoverageisTRUE).