# Coverage of code run at precompile time

**URL:** <https://discourse.julialang.org/t/coverage-of-code-run-at-precompile-time/3198>\
**Category:** General Usage\
**Tags:** question, testing, coverage\
**Created:** [April 13, 2017, 6:48am UTC](https://discourse.julialang.org/t/coverage-of-code-run-at-precompile-time/3198 "2017-04-13T06:48:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fengyang.wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fengyang.wang/32/104_2.png) [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Post date:** [April 13, 2017, 6:48am UTC](https://discourse.julialang.org/t/coverage-of-code-run-at-precompile-time/3198/1 "2017-04-13T06:48:03Z")

</div>

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](https://codecov.io/gh/TotalVerb/EnglishText.jl/src/b8df1e5107772817b16319903ce0073f86f5c12d/src/articulate.jl), the `process` function is incorrectly marked as missed, despite having indeed run at precompile time.

---

<div class="post-metadata">

**Author:** ![fengyang.wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fengyang.wang/32/104_2.png) [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Post date:** [April 13, 2017, 6:23pm UTC](https://discourse.julialang.org/t/coverage-of-code-run-at-precompile-time/3198/2 "2017-04-13T18:23:03Z")

</div>

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](https://github.com/TotalVerb/EnglishText.jl/pull/6/files)

for an example of a fix to this problem.
