lib/inspec/runner.rb in inspec-1.51.0 vs lib/inspec/runner.rb in inspec-1.51.6
- old
+ new
@@ -47,10 +47,13 @@
@test_collector = @conf.delete(:test_collector) || begin
require 'inspec/runner_rspec'
RunnerRspec.new(@conf)
end
+ # parse any ad-hoc runners reporter formats
+ @conf = Inspec::BaseCLI.parse_reporters(@conf) if @conf[:type].nil?
+
# list of profile attributes
@attributes = []
load_attributes(@conf)
configure_transport
@@ -99,10 +102,18 @@
Inspec::Log.debug "Starting run with targets: #{@target_profiles.map(&:to_s)}"
load
run_tests(with)
end
+ def render_output(run_data)
+ return if @conf['reporter'].nil?
+
+ @conf['reporter'].each do |reporter|
+ Inspec::Reporters.render(reporter, run_data)
+ end
+ end
+
def write_lockfile(profile)
return false if !profile.writable?
if profile.lockfile_exists?
Inspec::Log.debug "Using existing lockfile #{profile.lockfile_path}"
@@ -112,10 +123,12 @@
File.write(profile.lockfile_path, lockfile.to_yaml)
end
end
def run_tests(with = nil)
- @test_collector.run(with)
+ status, run_data = @test_collector.run(with)
+ render_output(run_data)
+ status
end
# determine all attributes before the execution, fetch data from secrets backend
def load_attributes(options)
options[:attributes] ||= {}