Sha256: 3ea429734dfdeb9be97923c2fcaf60dd3480c55810f545968d55fbee5a8d8f7c

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

# frozen_string_literal: true

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

def initialize(context)
	super
	
	require_relative '../../lib/covered/config'
end

# Validate the coverage of multiple test runs.
# @parameter paths [Array(String)] The coverage database paths.
# @parameter minimum [Float] The minimum required coverage in order to pass.
def validate(paths: nil, minimum: 1.0)
	policy = Covered::Policy.new
	
	paths&.each do |path|
		# It would be nice to have a better algorithm here than just ignoring mtime - perhaps using checksums?
		Covered::Persist.new(policy.output, path).load!(ignore_mtime: true)
	end
	
	statistics = Covered::Statistics.new
	
	policy.each do |coverage|
		statistics << coverage
	end
	
	statistics.print($stderr)
	
	statistics.validate!(minimum)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
covered-0.22.0 bake/covered/validate.rb
covered-0.21.0 bake/covered/validate.rb
covered-0.20.2 bake/covered/validate.rb
covered-0.20.1 bake/covered/validate.rb