On this page:
1.1 Gotchas

1 Basic 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:

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.1 Gotchas

Internally cover uses the logger to transmit coverage. This means that dynamically loading a module with current-logger set to a logger who’s (transitive) parent is not the global logger may cause cover to hang.

Cover runs submodules directly. This means that if the test submodule is not constructed with a module+ or a module* with #f for the language the enclosing module will not be run.

Cover annotates fully expanded programs, and infers what areas of the original program to mark as covered via syntax-location. This means that sometimes, If a macro does not correctly propagate the syntax-location for some syntax object, the coverage information will appear to be incorrect. For example, the for loops will always have their variable binding positions marked as uncovered, unless the for clause binds only one variable and uses one of the special sequence forms like in-list. Another common instance of this is that provides in typed/racket.