ropensci-org / rotemplate

pkgdown template for rOpenSci packages :nail_care: :sparkles:
https://docs.ropensci.org/rotemplate
Other
25 stars 6 forks source link

Add tests with mathjax and boostwatch #75

Closed jeroen closed 2 years ago

jeroen commented 2 years ago

Our wrapper needs to overwrite the template:params however I keep breaking one case when fixing another.

It seems that if we pass a list() in our overrides, the params merge (instead of replace) the ones from the _pkgdown.yml. In this scenario we get an error like here.

Error : Can't find Bootswatch theme 'readable' (template.bootswatch in '_pkgdown.yml') for Bootstrap version '5' (template.bootstrap in '_pkgdown.yml')

So instead I tried to set params=NULL in our overrides and manually set mathjax = TRUE later in the wrapper, but then I found out this had broken our mathjax docs again.

So now I reverted it again, but we really need unit tests that test at least these two scenarios.

maelle commented 2 years ago

One idea. Adding a fewlines after https://github.com/ropensci-org/rotemplate/blob/4c5a93c826fcae7ea3f8a038834a5fdb8de15d1f/R/build-site.R#L38 that, if the code is run in a test, write out the pkgdown object somewhere so we could check it has what we expect. Or, some tests on the resulting website.

jeroen commented 2 years ago

The problem was that somehow, even if I was manually setting pkg$meta$template$mathjax <- TRUE the resulting site somehow still didn't have mathjax. I have no idea why.

I think the best way to test is the same as the unit tests in pkgdown itself: create a dummy package in tests that exercises some common problems with out template, and then add a unit test that runs build_ropensci_docs() on that package and then checks the output html if mathjax is there.

jeroen commented 2 years ago

Apparently the boostwatch thing is broken again 😢 https://github.com/r-universe/ropensci/runs/4873291211?check_suite_focus=true

jeroen commented 2 years ago

Trying this now: https://github.com/ropensci-org/rotemplate/commit/0175391d675e1decc7be10a3cf71c8864d213404

maelle commented 2 years ago

Any comment on #79? After a first review I can add tests for "the bootswatch thing". :grin: