Is there any way (using stack
) to generate Haddock documentation for the test modules?
The command:
stack haddock
will generate documentation for the library modules. I've tried to change some command line options using haddock-arguments
without any success.
Even if stack
doesn't support this, I'm open to other options.
stack exec -- haddock test/**/*.hs -odocs -h
I tested with stack 1.7.1 and haddock 2.20.0.
It's not clear what platform you are on; that will work on zsh on linux. The principle should work on other platforms. It runs haddock on all the .hs
files in the test
directory and puts the html output (-h
) in the docs
directory (which it creates, if necessary). It seems to overwrite whatever is in there.
You may wish to raise a feature request on the stack issue tracker, too. It's a good suggestion! And the resulting command would include the correct dependency links, without you having to supply them yourself.
Finally, Cabal, with its new-build
options, can apparently do this (I haven't tested it). The haddock-tests: True
option would go in the cabal.project
file.