1Basic Usage of Cover

The cover library adds the command raco cover command to run test coverage. For
every file it is given it will execute that file and its test submodule (it if
exists). It will then dump the coverage information into a directory, by default
"coverage". By default the coverage information will be generated as html.

The raco cover command accepts the following flags:

-f or --format
— Sets the coverage output type. Can be included more than once.
This flag defaults to html. Valid formats are:

-n or --no-output-for-path
— excludes any directories by name from the coverage report.
Files in these directories are still run, but are not annotated and omitted from the coverage
report. This flag may appear any number of times.

-i or --include-extensions
— include the given regular expression in the list of file patterns
used when expanding directories, searching for files to cover.

-v or --verbose
— enable verbose logging

-s or --submodule
— run the given submodule instead of the test submodule. Can be
included more than once.

-e or --irrelevant-submodules
— Consider the given submodules irrelevant when generating coverage. If not
provided defaults to all submodules. Can be included more than once.

-c or --collection
— Interprets the arguments as collections whose content should be
tested (in the same way as directory content).

-p or --package
— Interprets all arguments as packages whose contents should be tested
(in the same way as directory content). All package scopes are searched
for the first, most specific
package scope.

-m or --modules
— Interpret arguments as modules. This ignores arguments unless
they are files with the extension ".rkt", or ".scrbl".

-l or --lib
— Interpret arguments as libraries.

In addition raco cover supports the test-omit-paths and
test-command-line-arguments"info.rkt" options like raco test. In
addition cover supports cover-omit-paths, which is identical to test-omit-paths,
but is specific to cover. The same holds for test-include-paths and
cover-include-paths.

1.1Caveats, Known Bugs, and Odd Behavior

Cover is capable of covering code at phases above 0. However cover runs post-expansion, which
means it can only cover the body of macros that are used outside of their defining module.

Sometimes, if a macro does not propagate the syntax-location for some syntax object in
a way cover understands, the coverage information will appear to be incorrect.

If a test submodule is not constructed with a module+ or a module* with
#f for the language the enclosing module will not be run.

Dynamically loading a covered module with current-logger set to a logger who’s (transitive)
parent is not the global logger may cause Cover to hang.