You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,8 @@ that each plot is correct.
41
41
42
42
1) Run `devtools::test()` to execute the tests as normal.
43
43
44
+
When a figure doesn't matched the saved version, vdiffr signals a failure when it is run interactively, or when it is run on Travis or Appveyor. Mismatches do not cause R CMD check to fail on CRAN machines. See the testing versus monitoring section below.
45
+
44
46
45
47
### Adding expectations
46
48
@@ -123,6 +125,23 @@ You can run the tests the usual way, for example with
123
125
will be skipped. Failed tests will show as an error.
124
126
125
127
128
+
### Testing versus Monitoring
129
+
130
+
When a figure doesn't match its saved version, it is only reported as a failure under these circumstances:
131
+
132
+
- When the `NOT_CRAN` environment is set. In particular, devtools sets this when running the tests interactively.
133
+
134
+
- On Travis, Appveyor, or any environment where the `Sys.getenv("CI")` is set.
135
+
136
+
Otherwise, the failure is ignored. The motivation for this is that vdiffr is a monitoring tool and shouldn't cause R CMD check failures on the CRAN machines.
137
+
138
+
Checking the appearance of a figure is inherently fragile. It is a bit like testing for errors by matching exact error messages. These messages are susceptible to change at any time. Similarly, the appearance of plots depends on a lot of upstream code, such as the way margins and spacing are computed. vdiffr uses a special ggplot2 theme that should change very rarely, but there are just too many upstream factors that could cause breakages. For this reason, figure mismatches are not necessarily representative of actual failures.
139
+
140
+
Visual testing is not an alternative to writing unit tests for the internal data transformations performed during the creation of your figure. It is more of a monitoring tool that allows you to quickly check how the appearance of your figures changes over time, and to manually assess whether changes reflect actual problems in your packages.
141
+
142
+
If you want vdiffr to fail on CRAN machines as well, just set the environment variable `CI` to `"true"` in a `setup-vdiffr.R` file in your testthat folder.
143
+
144
+
126
145
### RStudio integration
127
146
128
147
An addin to launch `manage_cases()` is provided with vdiffr. Use the
0 commit comments