Clean up simplecov reporting
This commit is contained in:
parent
3a5db626ac
commit
9d6321685e
2
Gemfile
2
Gemfile
@ -3,7 +3,7 @@ source 'https://rubygems.org'
|
|||||||
gem "base64"
|
gem "base64"
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
gem "rake"
|
gem "rake"
|
||||||
gem "simplecov", "~> 0.15.0"
|
gem "simplecov"
|
||||||
gem "openssl"
|
gem "openssl"
|
||||||
if RbConfig::CONFIG["host"]["msys"]
|
if RbConfig::CONFIG["host"]["msys"]
|
||||||
gem "json", "2.1.0"
|
gem "json", "2.1.0"
|
||||||
|
|||||||
15
Gemfile.lock
15
Gemfile.lock
@ -4,7 +4,7 @@ GEM
|
|||||||
base64 (0.3.0)
|
base64 (0.3.0)
|
||||||
date (3.5.1)
|
date (3.5.1)
|
||||||
diff-lcs (1.6.2)
|
diff-lcs (1.6.2)
|
||||||
docile (1.1.5)
|
docile (1.4.1)
|
||||||
erb (6.0.1)
|
erb (6.0.1)
|
||||||
json (2.18.0)
|
json (2.18.0)
|
||||||
openssl (4.0.0)
|
openssl (4.0.0)
|
||||||
@ -30,11 +30,12 @@ GEM
|
|||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.13.0)
|
rspec-support (~> 3.13.0)
|
||||||
rspec-support (3.13.6)
|
rspec-support (3.13.6)
|
||||||
simplecov (0.15.1)
|
simplecov (0.22.0)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1)
|
||||||
json (>= 1.8, < 3)
|
simplecov-html (~> 0.11)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov_json_formatter (~> 0.1)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.13.2)
|
||||||
|
simplecov_json_formatter (0.1.4)
|
||||||
stringio (3.2.0)
|
stringio (3.2.0)
|
||||||
syntax (1.2.2)
|
syntax (1.2.2)
|
||||||
tsort (0.2.0)
|
tsort (0.2.0)
|
||||||
@ -52,7 +53,7 @@ DEPENDENCIES
|
|||||||
rdoc
|
rdoc
|
||||||
redcarpet
|
redcarpet
|
||||||
rspec
|
rspec
|
||||||
simplecov (~> 0.15.0)
|
simplecov
|
||||||
syntax
|
syntax
|
||||||
yard
|
yard
|
||||||
|
|
||||||
|
|||||||
13
Rakefile.rb
13
Rakefile.rb
@ -8,6 +8,8 @@ end
|
|||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
require "rake/clean"
|
require "rake/clean"
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
require "simplecov"
|
||||||
|
require "stringio"
|
||||||
|
|
||||||
CLEAN.include %w[build_test_run .yardoc yard coverage test_run]
|
CLEAN.include %w[build_test_run .yardoc yard coverage test_run]
|
||||||
CLOBBER.include %w[dist gen large_project pkg]
|
CLOBBER.include %w[dist gen large_project pkg]
|
||||||
@ -22,11 +24,20 @@ RSpec::Core::RakeTask.new(:spec, :example_string) do |task, args|
|
|||||||
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
|
task.rspec_opts = %W[-e "#{args.example_string}" -f documentation]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
task :spec => :build_dist
|
|
||||||
task :spec do
|
task :spec do
|
||||||
ENV.delete("specs")
|
ENV.delete("specs")
|
||||||
end
|
end
|
||||||
task :spec => :build_tests
|
task :spec => :build_tests
|
||||||
|
task :spec do
|
||||||
|
original_stdout = $stdout
|
||||||
|
sio = StringIO.new
|
||||||
|
$stdout = sio
|
||||||
|
SimpleCov.collate Dir["coverage/.resultset.json", "coverage/bt*/.resultset.json"]
|
||||||
|
$stdout = original_stdout
|
||||||
|
sio.string.lines.each do |line|
|
||||||
|
$stdout.write(line) unless line =~ /Coverage report generated for/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
task :build_tests do |task, args|
|
task :build_tests do |task, args|
|
||||||
ENV["specs"] = "1"
|
ENV["specs"] = "1"
|
||||||
|
|||||||
@ -18,12 +18,13 @@ class Test
|
|||||||
attr_reader :name
|
attr_reader :name
|
||||||
attr_accessor :output
|
attr_accessor :output
|
||||||
|
|
||||||
def initialize(name, id, block)
|
def initialize(desc, id, block)
|
||||||
@name = name
|
@desc = desc
|
||||||
@id = id
|
@id = id
|
||||||
@run_dir = "#{BASE_DIR}/bt#{@id}"
|
@name = "bt#{sprintf("%03d", @id)}"
|
||||||
|
@run_dir = "#{BASE_DIR}/#{@name}"
|
||||||
@block = block
|
@block = block
|
||||||
@coverage_dir = "#{OWD}/coverage/bt#{@id}"
|
@coverage_dir = "#{OWD}/coverage/#{@name}"
|
||||||
@output = ""
|
@output = ""
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ end
|
|||||||
SimpleCov.start do
|
SimpleCov.start do
|
||||||
root(#{OWD.inspect})
|
root(#{OWD.inspect})
|
||||||
coverage_dir(#{@coverage_dir.inspect})
|
coverage_dir(#{@coverage_dir.inspect})
|
||||||
command_name "build_tests"
|
command_name "#{@name}"
|
||||||
filters.clear
|
filters.clear
|
||||||
add_filter do |src|
|
add_filter do |src|
|
||||||
!(src.filename[SimpleCov.root])
|
!(src.filename[SimpleCov.root])
|
||||||
@ -133,7 +134,7 @@ EOF
|
|||||||
end
|
end
|
||||||
# Remove output lines generated as a result of the test environment
|
# Remove output lines generated as a result of the test environment
|
||||||
stderr = stderr.lines.find_all do |line|
|
stderr = stderr.lines.find_all do |line|
|
||||||
not (line =~ /Warning: coverage data provided by Coverage.*exceeds number of lines/)
|
not (line =~ /Warning: coverage data provided by Coverage.*exceeds number of lines|Stopped processing SimpleCov/)
|
||||||
end.join
|
end.join
|
||||||
RunResults.new(stdout, stderr, status)
|
RunResults.new(stdout, stderr, status)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,6 +3,10 @@ if ENV["rscons_dist_specs"]
|
|||||||
else
|
else
|
||||||
require "simplecov"
|
require "simplecov"
|
||||||
|
|
||||||
|
class MyFormatter
|
||||||
|
def format(*args)
|
||||||
|
end
|
||||||
|
end
|
||||||
SimpleCov.start do
|
SimpleCov.start do
|
||||||
add_filter "/spec/"
|
add_filter "/spec/"
|
||||||
add_filter "/.bundle/"
|
add_filter "/.bundle/"
|
||||||
@ -14,6 +18,7 @@ else
|
|||||||
add_filter "test/rscons.rb"
|
add_filter "test/rscons.rb"
|
||||||
project_name "Rscons"
|
project_name "Rscons"
|
||||||
merge_timeout 3600
|
merge_timeout 3600
|
||||||
|
formatter(MyFormatter)
|
||||||
end
|
end
|
||||||
|
|
||||||
require "rscons"
|
require "rscons"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user