Module: Coverage::Autostart
- Defined in:
- lib/covered/autostart.rb
Overview
Integrates ‘covered` with Ruby’s ‘Coverage.autostart!` hook.
Class Method Summary collapse
-
.autostart! ⇒ Object
Start recording coverage information.
Class Method Details
.autostart! ⇒ Object
Start recording coverage information. Usage: RUBYOPT=-rcovered/autostart ruby my_script.rb Registers an ‘at_exit` hook which finishes coverage and writes reports for the original process.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/covered/autostart.rb', line 15 def self.autostart! config = Covered::Config.load config.start pid = Process.pid at_exit do # Don't break forked children: if Process.pid == pid config.finish if config.report? config.call($stderr) end end end end |