Build reports to document functions and unit tests

flow_doc()

The flow_doc() function provides a way to draw all the functions of a package and store them in an html report.

The pkg argument can be any package name, from base R, CRAN, or other including your local packages.

The out argument must be a path to an html file.

If out is left NULL, the report will be printed to a temporary file and will be opened automatically.

If you don’t provide pkg the currently developed package will be considered.

flow_test()

If you’re using the package {testthat} for your unit tests, flow_test() will help you explore them.

flow_test
flow_test

Below I ran flow::flow_test() after opening the project of my package {unglue}.

It built a report with a tab for each test file, then next to the code of each script we’re able to visualize the diagram of our package’s functions and the logical path taken by the code, so we can easily see what was tested and what potentially went wrong.

Successful tests are showed in green, while failed ones (none in the example above) will be shown in red. To show only the failed tests, set the argument failed_only to TRUE.

If its out parameter is left NULL, the report will be printed to a temporary file and will be opened automatically.

Other parameters are forwarded to flow_run().