

Note that the environment variable DEEP_COVER is set by deep-cover exec or DeepCover.start. For example you could insert require 'deep-cover' if ENV at the beginning of lib/my_awesome_gem.rb, before all the require_relative 'my_awesome_gem/fabulous_core_part_1'. Note that if some of your tests run by launching another process, that process will have to require 'deep-cover' also. If deep-cover is required after your code, then it won't be able to detect the coverage. Typically, you want to insert that line at the very top of test/test_helper.rb or spec/spec_helper.rb. You must call require 'deep-cover' before the code you want to cover is loaded. Note, this is a bit slower and may cause issues in your tests if your use relative paths that lead outside of the directory (Such as a dependency that is in a parent directory). Installationĭo the appropriate of the installation of the gem, then follow the steps that correspond to your situation.

Note on loops (!): DeepCover doesn't consider loops to be branches, but it'sĮasy to support it if needed. For Istanbul output, DeepCover has a different approach and covers all def and all blocks. Method coverage: MRI considers every method defined, including methods defined on objects or via define_method, class_eval, etc. Node coverage: MRI provides no way to tell which parts of any line is evaluated (e.g. Line coverage: MRI doesn't cover some lines (e.g.

These examples are direct outputs from our HTML reporter:
