Skip to content

Commit 31844fa

Browse files
committed
Polishing
1 parent 0c71a2a commit 31844fa

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

R/snapshot-github.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ snap_download_hint <- function() {
3636
run_id <- Sys.getenv("GITHUB_RUN_ID")
3737

3838
sprintf(
39-
"* Call `gh_download_snaps(\"%s\", %s)` to download the snapshots from GitHub.\n",
39+
"* Call `snapshot_download_gh(\"%s\", %s)` to download the snapshots from GitHub.\n",
4040
repository,
4141
run_id
4242
)

R/snapshot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ snapshot_accept_hint <- function(variant, file, reset_output = TRUE) {
368368
}
369369

370370
paste0(
371-
snap_download_hint(),
371+
if (on_gh()) snap_download_hint(),
372372
cli::format_inline(
373373
"* Run {.run testthat::snapshot_accept('{name}')} to accept the change."
374374
),

tests/testthat/_snaps/snapshot-file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
Code
5353
cat(snapshot_review_hint("lala", "foo.r", check = TRUE, ci = TRUE))
5454
Output
55+
* Call `snapshot_download_gh("r-lib/testthat", 123)` to download the snapshots from GitHub.
5556
* Run `testthat::snapshot_review('lala/')` to review changes
5657

5758
# expect_snapshot_file validates its inputs

tests/testthat/test-snapshot-file.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
test_that("diagonstics", {
2-
})
3-
41
test_that("expect_snapshot_file works", {
52
path <- write_tmp_lines(letters)
63
expect_snapshot_file(path, "foo.r", compare = compare_file_text)
@@ -164,6 +161,7 @@ test_that("snapshot_hint output differs in R CMD check", {
164161
snapshot_review_hint <- function(...) {
165162
testthat:::snapshot_review_hint(..., reset_output = FALSE)
166163
}
164+
withr::local_envvar(GITHUB_ACTIONS = "false")
167165

168166
expect_snapshot(cat(snapshot_review_hint(
169167
"lala",
@@ -187,7 +185,7 @@ test_that("snapshot_hint output differs in R CMD check", {
187185
withr::local_envvar(
188186
GITHUB_ACTIONS = "true",
189187
GITHUB_REPOSITORY = "r-lib/testthat",
190-
GITHUB_JOB = "123"
188+
GITHUB_RUN_ID = "123"
191189
)
192190
expect_snapshot(cat(snapshot_review_hint(
193191
"lala",

tests/testthat/test-snapshot.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ test_that("errors and warnings are folded", {
166166
# })
167167

168168
test_that("hint is informative", {
169+
withr::local_envvar("GITHUB_ACTIONS" = "false")
170+
169171
expect_snapshot({
170172
cat(snapshot_accept_hint("_default", "bar.R", reset_output = FALSE))
171173
cat(snapshot_accept_hint("foo", "bar.R", reset_output = FALSE))

0 commit comments

Comments
 (0)