Tests pass locally but fail on GitHub due to extra spaces added in snapshots

I've just upgraded the RoxygenNote version from 7.2.3 to 7.3.1. This change seems to cause some test failures due to an extra space added in snapshots that have markdown code chunks in it (```r => ``` r). All my tests pass locally with devtools::test() though.

What should I do to have my tests behave the same way both locally and remotely?

RoxygenNote is a field written by roxygen2, you should not touch it manually.

Nevertheless, as far as I know snapshot tests have nothing to do with that field. For what it's worth I see the same on my machine as you see on GitHub Actions. One explanation is that the snapshot format has changed in testthat. Try installing the latest version of testthat.

1 Like

Ah yes, I'm stupid, roxygen2 has nothing to do with that… I didn't edit that field myself but linked it to the problem since my actual modification couldn't cause the problem.

I updated testthat (latest CRAN version and the dev version too) but my tests keep passing locally without suggesting the change. I'll try updating other possibly related packages (maybe knitr or rmarkdown since it's an output produced by rmarkdown::render()) to see if that fixes it.

I needed to update knitr. Thanks @Gabor!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.