Sha256: 414cd59e9ed99122014d3af333dcedde6d630bbc985e834c150dee8301495e6d

Contents?: true

Size: 664 Bytes

Versions: 6

Compression:

Stored size: 664 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2022, by Samuel Williams.

module Covered
	module Sus
		def initialize(...)
			super
			
			# Defer loading the coverage configuration unless we are actually running with coverage enabled to avoid performance cost/overhead.
			if ENV['COVERAGE']
				require_relative 'config'
				
				@covered = Covered::Config.load(root: self.root)
				if @covered.record?
					@covered.enable
				end
			else
				@covered = nil
			end
		end
		
		def after_tests(assertions)
			super(assertions)
			
			if @covered&.record?
				@covered.disable
				@covered.call(self.output.io)
			end
		end
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
covered-0.18.1 lib/covered/sus.rb
covered-0.18.0 lib/covered/sus.rb
covered-0.17.1 lib/covered/sus.rb
covered-0.17.0 lib/covered/sus.rb
covered-0.16.9 lib/covered/sus.rb
covered-0.16.8 lib/covered/sus.rb