KaTeX
KaTeX copied to clipboard
Write tests for the CLI
It seems like this shouldn't be too hard to do. We could either search for particular strings in the output or use jest's snapshot feature. Not sure what's the most maintainable, maybe the snapshots if we formatted the output a bit. I think the cli just outputs a blob, but for diffing purposes we'd probably want to format it so that we have one tag per line. There are a couple of HTML formatters we could use.
Perhaps we could just test for equality between calling KaTeX via cli.js
and via renderToString
? Still useful to test that the command-line argument parsing is working.
That's a really good idea.
We should also test for duplicate command-line options passed into commander, probably by parsing SETTINGS_SCHEMA ourselves. (see #3375)