vdiffr icon indicating copy to clipboard operation
vdiffr copied to clipboard

How to solve issue of _snaps folder too large for CRAN (can't use .Rbuildignore)

Open jgabry opened this issue 2 years ago • 3 comments

Hi, thanks for the great package. I'm wondering if you have a recommendation for handling the following issue:

  • When using a lot of vdiffr visual tests the tests/testthat/_snaps directory becomes very large, resulting in CRAN complaining about package size.

  • Adding tests/testthat/_snaps to .Rbuildignore solves the CRAN problem but results in the visual tests not running (or really new snapshots are created) during R cmd check on GitHub Actions.

Sorry if I'm overlooking an obvious solution or if I missed a recommendation for this somewhere (I did a bunch of searching before opening this issue).

jgabry avatar Nov 14 '22 18:11 jgabry

I'm hitting this too and I don't think I have an excessive number of snapshots.

Would it be possible compress the individual svg files, and then uncompress them when reading in the snapshot for comparison? This will make tests slower but would drastically reduce the size of the svgs.

gavinsimpson avatar Jan 28 '23 16:01 gavinsimpson

svglite supports compressed svg if the filename has extension .svgz, so writing compressed SVG should be easy to handle. Not sure what's required on the testthat end to open these compressed svg files when comparing snapshots.

@lionel- where's the best place to raise this further? With the testthat developers?

gavinsimpson avatar Jan 28 '23 17:01 gavinsimpson

@gavinsimpson yup I think so

lionel- avatar Jan 31 '23 19:01 lionel-