Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when snapshots are discarded #1278

Merged
merged 4 commits into from
Dec 11, 2020

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Dec 11, 2020

Do we need to always warn with duplicate tests (is.null() vs. length() == 0)?

NEWS.md Outdated
@@ -1,12 +1,16 @@
# testthat (development version)

* A warning is given when snapshots are discarded due to reusing the same
test name (#1278, @krlmlr).

* New `testthat.progress.verbose_skips` option. Set to `FALSE` to stop
reporting skips as they occur, they will still appear in the summary
(#1209, @krlmlr).

* `CheckReporter` now always shows the full test name (#1268).

* Catch tests are no longer reported multiple times (#1237).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind deleting this bullet since it's repeated below and problem comes from a merge?

@@ -87,7 +90,7 @@ SnapshotReporter <- R6::R6Class("SnapshotReporter",
self$cur_snaps[[self$test]] <- self$old_snaps[[self$test]]

if (self$i > 0) {
testthat_warn("Snapshots reset after error/skip")
testthat_warn(paste0("Snapshots reset after error/skip: ", test))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't the test name have been printed above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, let's try and see.

@krlmlr krlmlr requested a review from hadley December 11, 2020 19:57
@krlmlr krlmlr changed the title Show name of test when snapshots are reset Warn when snapshots are discarded Dec 11, 2020
@krlmlr
Copy link
Member Author

krlmlr commented Dec 11, 2020

Do we need to always warn with duplicate tests (is.null() vs. length() == 0)?

R/snapshot-reporter.R Outdated Show resolved Hide resolved
Co-authored-by: Hadley Wickham <h.wickham@gmail.com>
@hadley
Copy link
Member

hadley commented Dec 11, 2020

Thanks!

@hadley hadley merged commit 8821548 into r-lib:master Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants