Skip to content

Is there a way to "unit test" a quarto project? #12313

Discussion options

You must be logged in to vote

For example, I'd like to test that the _quarto.yaml doesn't contain invalid keys/values, that the YAML frontmatter in my .qmd files is correct (whatever that means), and so on.

Quarto includes a validator, so it won't render unless it considers the YAML valid (for its own notion of valid, of course. It won't be able to catch, eg, typos in author names).

If you want to run these yourself, a good way to do it is to add a pre-render script to your quarto project: https://quarto.org/docs/projects/scripts.html#pre-and-post-render. You can also leverage quarto run and a Makefile if you don't want the tests to be run at every render. Finally, you might want to run quarto inspect in your projec…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JosephBARBIERDARNAL
Comment options

Answer selected by JosephBARBIERDARNAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants