Title: | Create a Readme Summary Page for GitHub testthat and covr Outputs |
---|---|
Description: | Create a README file to place in package test subdirectory to communicate with other users in more detail results of testthat and covr. |
Authors: | Jonathan Sidi [aut, cre] , Locke Data [fnd] (https://itsalocke.com) |
Maintainer: | Jonathan Sidi <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2 |
Built: | 2024-12-01 06:26:54 UTC |
Source: | https://github.com/yonicd/covrpage |
Run package_coverage
ignoring failing tests from test_dir
.
coverage_skip(test_path = "tests/testthat", test_skip = NULL)
coverage_skip(test_path = "tests/testthat", test_skip = NULL)
test_path |
character, path to test directory, Default: 'tests/testthat' |
test_skip |
data.frame, mapping of failing tests, PARAM_DESCRIPTION, Default: NULL |
If test_skip is NULL then a new test_dir will be run internally checking for failing tests.
Other utility:
covr_summary()
,
map_testthat_snapshot()
,
map_testthat()
,
map_test()
,
package_name()
,
testthat_summary()
Retrieve log of code coverages evaluated by covrpage that were committed to git version control.
covr_log()
covr_log()
data.frame
Other log:
covrpage_log()
## Not run: covr_log() ## End(Not run)
## Not run: covr_log() ## End(Not run)
Creates a summary data.frame for covr object output that
mimics the console print method of package_coverage
covr_summary(x, package, failed = FALSE)
covr_summary(x, package, failed = FALSE)
x |
covr object |
package |
character, package name |
failed |
flag for failed test, Default: FALSE |
data.frame
Other utility:
coverage_skip()
,
map_testthat_snapshot()
,
map_testthat()
,
map_test()
,
package_name()
,
testthat_summary()
Render the template of the covrpage in the package directory.
covrpage( path = getwd(), preview = TRUE, auto_push = FALSE, update_badge = TRUE, vignette = FALSE )
covrpage( path = getwd(), preview = TRUE, auto_push = FALSE, update_badge = TRUE, vignette = FALSE )
path |
path to package |
preview |
boolean, to open the output in viewer, Default: TRUE |
auto_push |
boolean, push to remote repo on exit, Default: FALSE |
update_badge |
boolean, locate badge in README and update with testthat results, Default: TRUE |
vignette |
boolean, if TRUE then the covrpage README will be copied as a vignette of the package, Default: FALSE |
Other invoke:
covrpage_ci()
,
covrpage_snapshot()
wrapper for covrpage call with switches for running after-success on travis and deploying gh-pages.
covrpage_ci(path = getwd(), ...)
covrpage_ci(path = getwd(), ...)
path |
character, path to package, Default: getwd() |
... |
arguments to pass to covrpage |
Other invoke:
covrpage_snapshot()
,
covrpage()
## Not run: if(interactive()){ covrpage_ci() } ## End(Not run)
## Not run: if(interactive()){ covrpage_ci() } ## End(Not run)
Retrieve log of covrpage README.md files committed to git version control
covrpage_log()
covrpage_log()
list
Other log:
covr_log()
## Not run: covrpage_log() ## End(Not run)
## Not run: covrpage_log() ## End(Not run)
Runs a covrpage on a GitHub repository in a sterile environment
covrpage_snapshot( repo, branch = NULL, PAT = Sys.getenv("GITHUB_PAT"), host = "api.github.com", preview = TRUE )
covrpage_snapshot( repo, branch = NULL, PAT = Sys.getenv("GITHUB_PAT"), host = "api.github.com", preview = TRUE )
repo |
character, Public GitHub repository |
branch |
character, Name of the branch to checkout. Default: NULL |
PAT |
character, GitHub Personal Access Token, Default: Sys.getenv("GITHUB_PAT") |
host |
character, GitHub API host to use, Default: "api.github.com" |
preview |
boolean, to open the output in viewer, Default: TRUE |
Creates a markdown output that is sent to the internal viewer.
Setting branch to NULL means that clone
will use the remote's default branch.
Other invoke:
covrpage_ci()
,
covrpage()
## Not run: if(interactive()){ covrpage_snapshot('tidyverse/purrr') } ## End(Not run)
## Not run: if(interactive()){ covrpage_snapshot('tidyverse/purrr') } ## End(Not run)
Create covrpage badge for test status and date that is connected to the README.md created in the tests directory.
make_badge(remote_origin = NULL, active_branch = NULL, tinyurl = TRUE)
make_badge(remote_origin = NULL, active_branch = NULL, tinyurl = TRUE)
remote_origin |
character, username/repo of the remote origin, Default: NULL |
active_branch |
character, current active git branch, Default: NULL |
tinyurl |
boolean, convert badge uri to tinyurl link, Default: TRUE |
if either inputs are NULL then the .git file is inspected to gather the information
character
Other setup:
tencrypt()
,
use_covrpage_vignette()
,
use_covrpage()
Query a test file to see what expectations are defined in it.
map_test(path)
map_test(path)
path |
character, path to file |
Return data.frame containing which expectations are in the test file by context/description/test/expectation/linerange
data.frame
Other utility:
coverage_skip()
,
covr_summary()
,
map_testthat_snapshot()
,
map_testthat()
,
package_name()
,
testthat_summary()
Query a testthat directory for the unit test structure.
map_testthat(path = "tests/testthat")
map_testthat(path = "tests/testthat")
path |
character, path to tests, Default: 'tests/testthat' |
Return data.frame containing which expecations are in the testthat directory by file/context/description/test/expectation/linerange
data.frame
Other utility:
coverage_skip()
,
covr_summary()
,
map_testthat_snapshot()
,
map_test()
,
package_name()
,
testthat_summary()
Runs a covrpage on a GitHub repository in a sterile environment
map_testthat_snapshot( repo, branch = NULL, PAT = Sys.getenv("GITHUB_PAT"), host = "api.github.com" )
map_testthat_snapshot( repo, branch = NULL, PAT = Sys.getenv("GITHUB_PAT"), host = "api.github.com" )
repo |
character, Public GitHub repository |
branch |
character, Name of the branch to checkout. Default: NULL |
PAT |
character, GitHub Personal Access Token, Default: Sys.getenv("GITHUB_PAT") |
host |
character, GitHub API host to use, Default: "api.github.com" |
Creates a markdown output that is sent to the internal viewer.
Setting branch to NULL means that clone
will use the remote's default branch.
tibble
Other utility:
coverage_skip()
,
covr_summary()
,
map_testthat()
,
map_test()
,
package_name()
,
testthat_summary()
## Not run: if(interactive()){ map_testthat_snapshot('tidyverse/purrr') } ## End(Not run)
## Not run: if(interactive()){ map_testthat_snapshot('tidyverse/purrr') } ## End(Not run)
Retrieve package name
package_name(path = getwd())
package_name(path = getwd())
path |
path to package |
Other utility:
coverage_skip()
,
covr_summary()
,
map_testthat_snapshot()
,
map_testthat()
,
map_test()
,
testthat_summary()
Add encrypted Travis environment variable to git directory and .travis.yml.
tencrypt( r_obj = Sys.getenv("GITHUB_PAT"), travis_env = "GITHUB_PAT", add = TRUE )
tencrypt( r_obj = Sys.getenv("GITHUB_PAT"), travis_env = "GITHUB_PAT", add = TRUE )
r_obj |
object value to encrypt |
travis_env |
character, name of Travis environment variable |
add |
boolean, add directly to .travis.yml, Default: TRUE |
Other setup:
make_badge()
,
use_covrpage_vignette()
,
use_covrpage()
Summary outputs for testthat object that is used in rmd
testthat_summary(x, type = c("short", "long"))
testthat_summary(x, type = c("short", "long"))
x |
list, testthat object output |
type |
character, format of the object output, Default: c("short", "long") |
data.frame
Other utility:
coverage_skip()
,
covr_summary()
,
map_testthat_snapshot()
,
map_testthat()
,
map_test()
,
package_name()
Adds bash file to execute after Travis test is successfully completed.
use_covrpage( file = ".travis/covrpage.sh", travis_type = c("bash", "pkgdown", "tic"), travis_blocks = c("after_success", "after_failure", "deploy_ghpages"), gh_user = gsub("@(.*?)$", "", system("git config user.email", intern = TRUE)), push_branch = "test", repo = system("git config travis.slug", intern = TRUE), deploy_branch = system("git rev-parse --abbrev-ref HEAD", intern = TRUE) )
use_covrpage( file = ".travis/covrpage.sh", travis_type = c("bash", "pkgdown", "tic"), travis_blocks = c("after_success", "after_failure", "deploy_ghpages"), gh_user = gsub("@(.*?)$", "", system("git config user.email", intern = TRUE)), push_branch = "test", repo = system("git config travis.slug", intern = TRUE), deploy_branch = system("git rev-parse --abbrev-ref HEAD", intern = TRUE) )
file |
character, file path to save bash script to, Default: '.travis/covrpage.sh' |
travis_type |
character, build .travis.yml template for bash script, pkgdown deployment or using the 'tic' package from ropenscilabs on GitHub Default: c('bash','pkgdown','tic') |
travis_blocks |
character, vector that defines what .travis.yml blocks tocreate, Default: c('after_success','after_failure','deploy_ghpages') |
gh_user |
character, Github user name, Default: gsub("@(.*?)$", "", system("git config user.email", intern = TRUE)) |
push_branch |
character, branch Travis will create to push updated covrpage readme file, Default: 'test' |
repo |
character, name of git repo that package is hosted on, Default: system("git config travis.slug", intern = TRUE) |
deploy_branch |
character, name of branch that current package build is located, Default: system("git rev-parse –abbrev-ref HEAD", intern = TRUE) (usually 'master') |
Other setup:
make_badge()
,
tencrypt()
,
use_covrpage_vignette()
use_covrpage(travis_type = 'bash',file=file.path(tempdir(),'myfile.sh')) #does not write to disk use_covrpage(travis_type = 'bash',file=NULL) use_covrpage(travis_type = 'pkgdown') use_covrpage(travis_type = 'pkgdown',travis_block = 'after_success') use_covrpage(travis_type = 'pkgdown',travis_block = 'after_failure') use_covrpage(travis_type = 'pkgdown',travis_block = c('after_success','after_failure'))
use_covrpage(travis_type = 'bash',file=file.path(tempdir(),'myfile.sh')) #does not write to disk use_covrpage(travis_type = 'bash',file=NULL) use_covrpage(travis_type = 'pkgdown') use_covrpage(travis_type = 'pkgdown',travis_block = 'after_success') use_covrpage(travis_type = 'pkgdown',travis_block = 'after_failure') use_covrpage(travis_type = 'pkgdown',travis_block = c('after_success','after_failure'))
Perform general setup and copying of tests/README.md into vignette subdirectory
use_covrpage_vignette(path = ".")
use_covrpage_vignette(path = ".")
path |
character, path to root of file, Default:'.' |
Other setup:
make_badge()
,
tencrypt()
,
use_covrpage()
## Not run: use_covrpage_vignette() ## End(Not run)
## Not run: use_covrpage_vignette() ## End(Not run)