Announce: a way to create test suites for CSL styles: jest-csl

Hi all,

I’m in the process of writing a big new style, and I made some tooling to make it easier. jest-csl is a way to do Test-Driven Development on CSL and CSL-M, by writing a specification for how your style should behave.

It takes your list of specs, and runs citeproc on all of them, collecting the results in an easy to use display. It can also spit out JSON of the completed test run, based on which you can write your own documentation generator. I hope it’s helpful to any style authors out there! There’s a mostly complete guide on how to use it in the README.

Three pictures, three thousand words:

  • A simple test case;
  • Some test output on the command line; and
  • Some documentation I generated, written as a React app (can’t share the source yet, but some of its components could be reusable for other projects):


Does not yet support testing <bibliography> output. If you need that, it won’t be difficult to add, just let me know.


Nice! I didn’t see your code for this until just now, which is a shame. Your structures would have been good discipline for the rewrite of the citeproc-js runner.

This will be super helpful for setting up tests for the big styles! I could use bibliography output support for APA style. Could you add that?

I added it a while back :slight_smile: let me know how it works for you, I haven’t written any big bibliography tests in it yet so I don’t know how ergonomic it is.

Also to get a feel for it, there’s which has substantial tests already. It’s also the source of that wicked rendered documentation screenshot.