While creating some new posts (migrating picked posts manually from a very old page) and also changing the structure of some existing posts (moved them to another folder) I haven’t noticed that I actually broke it.
What happened is that I only found it in prod when looking through the articles a bit (call it explorative testing) I noticed that a picture is gone on a post and the highlighted code is just concatenated to one big string without any formatting.
As I’m just starting out with hugo experiments, I have automated dev and prod deploys with CI and so on but I’m missing any real tests besides that hugo generates output and doesn’t throw any error.
With a handful posts, explorative testing is no issue but after it grows a bit, if it’s not automated you probably just need luck to not miss it.
As my day job is developing tools and frameworks that developers and testers can easily write automated tests in their projects, I need to stick to my principles and find a good solution at least for my own stuff and block broken output to dig it’s way into prod.
What ways do you use for sort of unit testing the generated code in your project(s)?
Are there already some ideas or solutions implemented?
I’m not looking at usual functional tests (no way this makes sense going trough this maintenance hell when you have lots of posts) but actually using the md files as spec and check it against the generated html.
Side effects could then also be to check for broken links, having specs for how certain shortcodes and template layout components need to look like from the structure, get a impact diff (when doing commits with small changes, see if it did fundamental changes to modified files or even had a side effect.