Coverage of code run at precompile time

question
testing
coverage

#1

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.


#2

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

for an example of a fix to this problem.