dmy / elm-doc-preview

Elm offline documentation previewer
https://www.npmjs.com/package/elm-doc-preview
Other
128 stars 15 forks source link

command-line output for use in automated tests #21

Closed skyqrose closed 5 years ago

skyqrose commented 5 years ago

I'd like to have my automated tests check that my docs are formatted well. If there are errors detected they're shown in the browser, and the checks done are more thorough than those done by the compiler. I'd like to be able to run the docs-previewer on the command line, see those errors there, and emit an exit code, without starting the webserver.

rlefevre commented 5 years ago

I'm not sure to understand. The checks done are exactly those done by the compiler run with:

elm make --docs=docs.json --report=json

This will exit with an error status in case of error. Then elm-doc-preview renders the errors from the json output.

So you could use this command in your tests and get the same checks as the ones done with elm-doc-preview. You don't have to use --report=json if you want a human readable output to report in your failed tests.

skyqrose commented 5 years ago

Ah, I didn't know about the elm make --docs flag. That satisfies my need. Thank you.

rlefevre commented 5 years ago

Ok, elm make --help can be useful then (it works for other elm commands too).