[mirror] Opinionated R package quickstart
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixed snapshot filenames

VisruthSK c45be3a1 8f2dff7d

+34 -41
+14 -16
tests/testthat/_snaps/workflow.md
··· 1 1 # workflow step: create_package creates git-backed package skeleton 2 2 3 3 Code 4 - sort(list.files(".", recursive = TRUE, all.files = TRUE, no.. = TRUE)) 4 + files[!grepl("^\\.git/", files)] 5 5 Output 6 6 [1] ".Rbuildignore" 7 - [2] ".git/config" 8 - [3] ".git/hooks/pre-commit" 9 - [4] ".github/dependabot.yml" 10 - [5] ".github/workflows/check-standard.yaml" 11 - [6] ".github/workflows/format-suggest.yaml" 12 - [7] ".github/workflows/test-coverage.yaml" 13 - [8] ".vscode/extensions.json" 14 - [9] "AGENTS.md" 15 - [10] "DESCRIPTION" 16 - [11] "LICENSE.md" 17 - [12] "NEWS.md" 18 - [13] "README.md" 19 - [14] "air.toml" 20 - [15] "tests/jarl.toml" 21 - [16] "tests/testthat.R" 7 + [2] ".github/dependabot.yml" 8 + [3] ".github/workflows/check-standard.yaml" 9 + [4] ".github/workflows/format-suggest.yaml" 10 + [5] ".github/workflows/test-coverage.yaml" 11 + [6] ".vscode/extensions.json" 12 + [7] "AGENTS.md" 13 + [8] "DESCRIPTION" 14 + [9] "LICENSE.md" 15 + [10] "NEWS.md" 16 + [11] "README.md" 17 + [12] "air.toml" 18 + [13] "tests/jarl.toml" 19 + [14] "tests/testthat.R" 22 20
tests/testthat/_snaps/workflow/workflow--Rbuildignore tests/testthat/_snaps/workflow/dot-Rbuildignore.txt
-2
tests/testthat/_snaps/workflow/workflow--git-config
··· 1 - [remote "origin"] 2 - url = git@github.com:example/demoPkg.git
-14
tests/testthat/_snaps/workflow/workflow--git-hooks-pre-commit
··· 1 - #!/usr/bin/env bash 2 - set -euo pipefail 3 - 4 - air format . --check || { 5 - air format . 6 - echo "Air reformatted files. Stage and recommit." >&2 7 - exit 1 8 - } 9 - 10 - jarl check . || { 11 - jarl check . --fix --allow-dirty || true 12 - echo "Jarl fixed issues. Stage and recommit." >&2 13 - exit 1 14 - }
tests/testthat/_snaps/workflow/workflow--github-dependabot-yml tests/testthat/_snaps/workflow/dot-github-dependabot.yml
tests/testthat/_snaps/workflow/workflow--github-workflows-check-standard-yaml tests/testthat/_snaps/workflow/dot-github-workflows-check-standard.yaml
tests/testthat/_snaps/workflow/workflow--github-workflows-format-suggest-yaml tests/testthat/_snaps/workflow/dot-github-workflows-format-suggest.yaml
tests/testthat/_snaps/workflow/workflow--github-workflows-test-coverage-yaml tests/testthat/_snaps/workflow/dot-github-workflows-test-coverage.yaml
tests/testthat/_snaps/workflow/workflow--vscode-extensions-json tests/testthat/_snaps/workflow/dot-vscode-extensions.json
tests/testthat/_snaps/workflow/workflow-AGENTS-md tests/testthat/_snaps/workflow/AGENTS.md
tests/testthat/_snaps/workflow/workflow-DESCRIPTION tests/testthat/_snaps/workflow/DESCRIPTION.txt
tests/testthat/_snaps/workflow/workflow-LICENSE-md tests/testthat/_snaps/workflow/LICENSE.md
tests/testthat/_snaps/workflow/workflow-NEWS-md tests/testthat/_snaps/workflow/NEWS.md
tests/testthat/_snaps/workflow/workflow-README-md tests/testthat/_snaps/workflow/README.md
tests/testthat/_snaps/workflow/workflow-tests-jarl-toml tests/testthat/_snaps/workflow/tests-jarl.toml
tests/testthat/_snaps/workflow/workflow-tests-testthat-R tests/testthat/_snaps/workflow/tests-testthat.R
+20 -9
tests/testthat/test-workflow.R
··· 154 154 fs::path(fixture$pkg_path, ...) 155 155 } 156 156 157 + snapshot_name_from_path <- function(path) { 158 + name <- gsub("[/\\\\]+", "-", path) 159 + name <- sub("^\\.+", "dot-", name) 160 + name <- gsub("[^A-Za-z0-9._-]", "-", name) 161 + 162 + if (nzchar(fs::path_ext(path))) { 163 + name 164 + } else { 165 + paste0(name, ".txt") 166 + } 167 + } 168 + 157 169 snapshot_workflow_files <- function(fixture, files) { 158 170 for (f in files) { 159 171 expect_true(file.exists(file_in_pkg(fixture, f)), info = f) 160 172 expect_snapshot_file( 161 173 file_in_pkg(fixture, f), 162 174 compare = testthat::compare_file_text, 163 - name = paste0( 164 - "workflow-", 165 - gsub("[^A-Za-z0-9_-]", "-", f) 166 - ) 175 + name = snapshot_name_from_path(f) 167 176 ) 168 177 } 169 178 } ··· 172 181 fixture <- run_workflow_fixture() 173 182 174 183 expect_true(isTRUE(fixture$github_private)) 184 + expect_true(file.exists(file_in_pkg(fixture, ".git", "config"))) 175 185 expect_false(file.exists(file_in_pkg(fixture, "demoPkg.Rproj"))) 176 186 177 187 old <- setwd(fixture$pkg_path) 178 188 on.exit(setwd(old), add = TRUE) 179 - expect_snapshot(sort(list.files( 189 + files <- sort(list.files( 180 190 ".", 181 191 recursive = TRUE, 182 192 all.files = TRUE, 183 193 no.. = TRUE 184 - ))) 194 + )) 195 + expect_snapshot(files[!grepl("^\\.git/", files)]) 185 196 186 197 snapshot_workflow_files( 187 198 fixture, 188 - c("DESCRIPTION", "LICENSE.md", ".Rbuildignore", ".git/config") 199 + c("DESCRIPTION", "LICENSE.md", ".Rbuildignore") 189 200 ) 190 201 }) 191 202 ··· 228 239 ".github/dependabot.yml", 229 240 "AGENTS.md", 230 241 "tests/jarl.toml", 231 - ".vscode/extensions.json", 232 - ".git/hooks/pre-commit" 242 + ".vscode/extensions.json" 233 243 ) 234 244 ) 245 + expect_true(file.exists(file_in_pkg(fixture, ".git", "hooks", "pre-commit"))) 235 246 })