Skip to content

Commit

Permalink
chore: remove Crashpad directory when checking the package
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Sobolewski committed May 22, 2024
1 parent 2a768eb commit d872ff1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Imports:
shiny.react (>= 0.4.0),
utils
Suggests:
chromote,
covr,
knitr,
lintr (>= 3.0.0),
Expand All @@ -38,5 +39,6 @@ Suggests:
rmarkdown,
shiny.router,
shinytest2,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
withr
Config/testthat/edition: 3
30 changes: 30 additions & 0 deletions tests/testthat/setup-disable-crashpad.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ❯ checking for detritus in the temp directory ... NOTE
# Found the following files/directories:
# ‘Crashpad’
#
# 0 errors ✔ | 0 warnings ✔ | 1 note ✖
# Error: Error: R CMD check found NOTEs
# Flavors: ubuntu-22.04 (devel), ubuntu-22.04 (release), ubuntu-22.04 (oldrel)

# References (shinytest2 github):
# 1. https://github.com/rstudio/shinytest2/blob/main/cran-comments.md
# 2. https://github.com/rstudio/shinytest2/blob/main/tests/testthat/setup-disable-crashpad.R

# Disable crash reporting on CRAN machines. (Can't get the report anyways)
chromote::set_chrome_args(c(
# https://peter.sh/experiments/chromium-command-line-switches/#disable-crash-reporter
#> Disable crash reporter for headless. It is enabled by default in official builds
"--disable-crash-reporter",
chromote::default_chrome_args()
))

# Make sure the temp folder is removed when testing is complete
withr::defer({

# Clean up chromote sessions
gc() # Run R6 finalizer methods
Sys.sleep(2) # Wait for any supervisors to exit

# Delete the Crashpad folder if it exists
unlink(file.path(tempdir(), "Crashpad"), recursive = TRUE)
}, envir = testthat::teardown_env())

0 comments on commit d872ff1

Please sign in to comment.