r-lib / testthat

An R 📦 to make testing 😀
https://testthat.r-lib.org
Other
869 stars 313 forks source link

How to use snapshot on Github (snapshot differs local from github) #1915

Open latot opened 6 months ago

latot commented 6 months ago

Hi all, I started using snapshot to take errors on a package, the use is pretty simple, of the library and how snapshot works, I followed docs to implement it, I have also implemented it in other places.

So, the main point in this issue is how to use snapshots with github, for some reason, actually we can run snapshots locally and all will works just fine, until we try to run the same snapshots on github and for some reason, some package or R it self change the behavior of print things and the tests fails.

So the question would be, how can we get sure to normalize the output of packages or waldo to be able to run the tests locally and on github.

Here is a sample: https://github.com/CIT-UAI/geotypes/pull/20

You can see there how and why fails, and is because something on printing changed on CI, while locally all is fine.

Maybe, instead update docs, would be possible to when is done library(testthat) execute some statements to be sure the output format is common.

I think would be useful have some docs about this.

Thx!

Johan-rosa commented 4 months ago

Same issue here. On github the snapshot has a line brake in a different place. Example:

Locally

paste(
  "Hello,", "how",
  "are", "your"
)

Github

paste(
  "Hello,", 
  "how", "are", "your"
)