Coverage of code run at precompile time

Coverage doesn’t seem to capture lines which are executed only during package precompile time and not while actually running the tests. Is there a way to also track coverage for these lines?

In this example, the process function is incorrectly marked as missed, despite having indeed run at precompile time.

I’ve found a workaround to this problem:

  • Test on Travis/Appveyor with --compilecache=no; this runs the tests without precompilation so as to gather accurate coverage stats
  • Then add an extra line julia -e 'using Package' to test the precompilation itself

See

https://github.com/TotalVerb/EnglishText.jl/pull/6/files

for an example of a fix to this problem.