simplecov 0.6.4 → 0.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +378 -12
- data/CONTRIBUTING.md +51 -0
- data/ISSUE_TEMPLATE.md +23 -0
- data/LICENSE +1 -1
- data/README.md +456 -252
- data/doc/alternate-formatters.md +56 -0
- data/doc/commercial-services.md +20 -0
- data/doc/editor-integration.md +18 -0
- data/lib/simplecov.rb +223 -44
- data/lib/simplecov/command_guesser.rb +47 -35
- data/lib/simplecov/configuration.rb +281 -191
- data/lib/simplecov/defaults.rb +38 -43
- data/lib/simplecov/exit_codes.rb +10 -0
- data/lib/simplecov/file_list.rb +51 -34
- data/lib/simplecov/filter.rb +50 -3
- data/lib/simplecov/formatter.rb +4 -1
- data/lib/simplecov/formatter/multi_formatter.rb +34 -0
- data/lib/simplecov/formatter/simple_formatter.rb +18 -12
- data/lib/simplecov/jruby_fix.rb +44 -0
- data/lib/simplecov/last_run.rb +26 -0
- data/lib/simplecov/lines_classifier.rb +48 -0
- data/lib/simplecov/load_global_config.rb +8 -0
- data/lib/simplecov/no_defaults.rb +4 -0
- data/lib/simplecov/profiles.rb +33 -0
- data/lib/simplecov/profiles/bundler_filter.rb +5 -0
- data/lib/simplecov/profiles/hidden_filter.rb +5 -0
- data/lib/simplecov/profiles/rails.rb +18 -0
- data/lib/simplecov/profiles/root_filter.rb +10 -0
- data/lib/simplecov/profiles/test_frameworks.rb +8 -0
- data/lib/simplecov/railtie.rb +3 -1
- data/lib/simplecov/railties/tasks.rake +9 -7
- data/lib/simplecov/raw_coverage.rb +41 -0
- data/lib/simplecov/result.rb +17 -55
- data/lib/simplecov/result_merger.rb +100 -67
- data/lib/simplecov/source_file.rb +82 -67
- data/lib/simplecov/version.rb +4 -2
- metadata +153 -222
- data/.gitignore +0 -31
- data/.travis.yml +0 -15
- data/Appraisals +0 -8
- data/Gemfile +0 -5
- data/Rakefile +0 -19
- data/cucumber.yml +0 -13
- data/features/config_adapters.feature +0 -44
- data/features/config_autoload.feature +0 -46
- data/features/config_command_name.feature +0 -33
- data/features/config_coverage_dir.feature +0 -20
- data/features/config_deactivate_merging.feature +0 -42
- data/features/config_merge_timeout.feature +0 -39
- data/features/config_nocov_token.feature +0 -79
- data/features/config_project_name.feature +0 -27
- data/features/config_styles.feature +0 -93
- data/features/cucumber_basic.feature +0 -29
- data/features/merging_test_unit_and_rspec.feature +0 -44
- data/features/rspec_basic.feature +0 -31
- data/features/rspec_fails_on_initialization.feature +0 -14
- data/features/rspec_groups_and_filters_basic.feature +0 -29
- data/features/rspec_groups_and_filters_complex.feature +0 -35
- data/features/rspec_groups_using_filter_class.feature +0 -40
- data/features/rspec_without_simplecov.feature +0 -20
- data/features/skipping_code_blocks_manually.feature +0 -70
- data/features/step_definitions/html_steps.rb +0 -45
- data/features/step_definitions/simplecov_steps.rb +0 -66
- data/features/step_definitions/transformers.rb +0 -13
- data/features/step_definitions/web_steps.rb +0 -64
- data/features/support/env.rb +0 -26
- data/features/test_unit_basic.feature +0 -34
- data/features/test_unit_groups_and_filters_basic.feature +0 -29
- data/features/test_unit_groups_and_filters_complex.feature +0 -35
- data/features/test_unit_groups_using_filter_class.feature +0 -40
- data/features/test_unit_without_simplecov.feature +0 -20
- data/features/unicode_compatiblity.feature +0 -67
- data/gemfiles/multi_json-legacy.gemfile +0 -7
- data/gemfiles/multi_json-legacy.gemfile.lock +0 -85
- data/gemfiles/multi_json-new.gemfile +0 -7
- data/gemfiles/multi_json-new.gemfile.lock +0 -85
- data/lib/simplecov/adapters.rb +0 -29
- data/lib/simplecov/merge_helpers.rb +0 -39
- data/simplecov.gemspec +0 -29
- data/test/faked_project/Gemfile +0 -6
- data/test/faked_project/Rakefile +0 -8
- data/test/faked_project/cucumber.yml +0 -13
- data/test/faked_project/features/step_definitions/my_steps.rb +0 -23
- data/test/faked_project/features/support/env.rb +0 -12
- data/test/faked_project/features/test_stuff.feature +0 -6
- data/test/faked_project/lib/faked_project.rb +0 -11
- data/test/faked_project/lib/faked_project/framework_specific.rb +0 -18
- data/test/faked_project/lib/faked_project/meta_magic.rb +0 -24
- data/test/faked_project/lib/faked_project/some_class.rb +0 -29
- data/test/faked_project/spec/faked_spec.rb +0 -11
- data/test/faked_project/spec/meta_magic_spec.rb +0 -10
- data/test/faked_project/spec/some_class_spec.rb +0 -10
- data/test/faked_project/spec/spec_helper.rb +0 -15
- data/test/faked_project/test/faked_test.rb +0 -11
- data/test/faked_project/test/meta_magic_test.rb +0 -13
- data/test/faked_project/test/some_class_test.rb +0 -15
- data/test/faked_project/test/test_helper.rb +0 -16
- data/test/fixtures/app/controllers/sample_controller.rb +0 -10
- data/test/fixtures/app/models/user.rb +0 -10
- data/test/fixtures/deleted_source_sample.rb +0 -15
- data/test/fixtures/frameworks/rspec_bad.rb +0 -9
- data/test/fixtures/frameworks/rspec_good.rb +0 -9
- data/test/fixtures/frameworks/testunit_bad.rb +0 -9
- data/test/fixtures/frameworks/testunit_good.rb +0 -9
- data/test/fixtures/iso-8859.rb +0 -3
- data/test/fixtures/resultset1.rb +0 -4
- data/test/fixtures/resultset2.rb +0 -5
- data/test/fixtures/sample.rb +0 -16
- data/test/fixtures/utf-8.rb +0 -3
- data/test/helper.rb +0 -35
- data/test/shoulda_macros.rb +0 -29
- data/test/test_1_8_fallbacks.rb +0 -33
- data/test/test_command_guesser.rb +0 -21
- data/test/test_deleted_source.rb +0 -16
- data/test/test_file_list.rb +0 -24
- data/test/test_filters.rb +0 -80
- data/test/test_merge_helpers.rb +0 -107
- data/test/test_result.rb +0 -147
- data/test/test_return_codes.rb +0 -39
- data/test/test_source_file.rb +0 -95
- data/test/test_source_file_line.rb +0 -110
@@ -1,85 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/colszowka/Projects/github/colszowka/simplecov
|
3
|
-
specs:
|
4
|
-
simplecov (0.6.2)
|
5
|
-
multi_json (~> 1.0)
|
6
|
-
simplecov-html (~> 0.5.3)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.2.8)
|
12
|
-
appraisal (0.4.1)
|
13
|
-
bundler
|
14
|
-
rake
|
15
|
-
aruba (0.4.11)
|
16
|
-
childprocess (>= 0.2.3)
|
17
|
-
cucumber (>= 1.1.1)
|
18
|
-
ffi (>= 1.0.11)
|
19
|
-
rspec (>= 2.7.0)
|
20
|
-
builder (3.0.0)
|
21
|
-
capybara (1.1.2)
|
22
|
-
mime-types (>= 1.16)
|
23
|
-
nokogiri (>= 1.3.3)
|
24
|
-
rack (>= 1.0.0)
|
25
|
-
rack-test (>= 0.5.4)
|
26
|
-
selenium-webdriver (~> 2.0)
|
27
|
-
xpath (~> 0.1.4)
|
28
|
-
childprocess (0.3.2)
|
29
|
-
ffi (~> 1.0.6)
|
30
|
-
cucumber (1.2.0)
|
31
|
-
builder (>= 2.1.2)
|
32
|
-
diff-lcs (>= 1.1.3)
|
33
|
-
gherkin (~> 2.10.0)
|
34
|
-
json (>= 1.4.6)
|
35
|
-
diff-lcs (1.1.3)
|
36
|
-
ffi (1.0.11)
|
37
|
-
gherkin (2.10.0)
|
38
|
-
json (>= 1.4.6)
|
39
|
-
json (1.7.1)
|
40
|
-
libwebsocket (0.1.3)
|
41
|
-
addressable
|
42
|
-
mime-types (1.18)
|
43
|
-
multi_json (1.3.4)
|
44
|
-
nokogiri (1.5.2)
|
45
|
-
rack (1.4.1)
|
46
|
-
rack-test (0.6.1)
|
47
|
-
rack (>= 1.0)
|
48
|
-
rake (0.9.2.2)
|
49
|
-
rspec (2.10.0)
|
50
|
-
rspec-core (~> 2.10.0)
|
51
|
-
rspec-expectations (~> 2.10.0)
|
52
|
-
rspec-mocks (~> 2.10.0)
|
53
|
-
rspec-core (2.10.0)
|
54
|
-
rspec-expectations (2.10.0)
|
55
|
-
diff-lcs (~> 1.1.3)
|
56
|
-
rspec-mocks (2.10.1)
|
57
|
-
rubyzip (0.9.8)
|
58
|
-
selenium-webdriver (2.21.2)
|
59
|
-
childprocess (>= 0.2.5)
|
60
|
-
ffi (~> 1.0)
|
61
|
-
libwebsocket (~> 0.1.3)
|
62
|
-
multi_json (~> 1.0)
|
63
|
-
rubyzip
|
64
|
-
shoulda (3.0.1)
|
65
|
-
shoulda-context (~> 1.0.0)
|
66
|
-
shoulda-matchers (~> 1.0.0)
|
67
|
-
shoulda-context (1.0.0)
|
68
|
-
shoulda-matchers (1.0.0)
|
69
|
-
simplecov-html (0.5.3)
|
70
|
-
xpath (0.1.4)
|
71
|
-
nokogiri (~> 1.3)
|
72
|
-
|
73
|
-
PLATFORMS
|
74
|
-
ruby
|
75
|
-
|
76
|
-
DEPENDENCIES
|
77
|
-
appraisal
|
78
|
-
aruba
|
79
|
-
capybara
|
80
|
-
cucumber (>= 1.1.4)
|
81
|
-
multi_json (>= 1.3.4)
|
82
|
-
rake
|
83
|
-
rspec
|
84
|
-
shoulda
|
85
|
-
simplecov!
|
data/lib/simplecov/adapters.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Adapters are glorified SimpleCov configuration procs that can be easily
|
3
|
-
# loaded using SimpleCov.start :rails and defined using
|
4
|
-
# SimpleCov.adapters.define :foo do
|
5
|
-
# # SimpleCov configuration here, same as in SimpleCov.configure
|
6
|
-
# end
|
7
|
-
#
|
8
|
-
class SimpleCov::Adapters < Hash
|
9
|
-
#
|
10
|
-
# Define a SimpleCov adapter:
|
11
|
-
# SimpleCov.adapters.define 'rails' do
|
12
|
-
# # Same as SimpleCov.configure do .. here
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
def define(name, &blk)
|
16
|
-
name = name.to_sym
|
17
|
-
raise "SimpleCov Adapter '#{name}' is already defined" unless self[name].nil?
|
18
|
-
self[name] = blk
|
19
|
-
end
|
20
|
-
|
21
|
-
#
|
22
|
-
# Applies the adapter of given name on SimpleCov.configure
|
23
|
-
#
|
24
|
-
def load(name)
|
25
|
-
name = name.to_sym
|
26
|
-
raise "Could not find SimpleCov Adapter called '#{name}'" unless has_key?(name)
|
27
|
-
SimpleCov.configure(&self[name])
|
28
|
-
end
|
29
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module SimpleCov::ArrayMergeHelper
|
2
|
-
# Merges an array of coverage results with self
|
3
|
-
def merge_resultset(array)
|
4
|
-
new_array = []
|
5
|
-
|
6
|
-
self.each_with_index do |element, i|
|
7
|
-
new_array[i] = element
|
8
|
-
end
|
9
|
-
|
10
|
-
array.each_with_index do |element, i|
|
11
|
-
if element.nil? and new_array[i].nil?
|
12
|
-
new_array[i] = nil
|
13
|
-
else
|
14
|
-
local_value = element || 0
|
15
|
-
other_value = new_array[i] || 0
|
16
|
-
new_array[i] = local_value + other_value
|
17
|
-
end
|
18
|
-
end
|
19
|
-
new_array
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
module SimpleCov::HashMergeHelper
|
24
|
-
# Merges the given Coverage.result hash with self
|
25
|
-
def merge_resultset(hash)
|
26
|
-
new_resultset = {}
|
27
|
-
(self.keys + hash.keys).each do |filename|
|
28
|
-
new_resultset[filename] = []
|
29
|
-
end
|
30
|
-
|
31
|
-
new_resultset.each do |filename, data|
|
32
|
-
new_resultset[filename] = (self[filename] || []).merge_resultset(hash[filename] || [])
|
33
|
-
end
|
34
|
-
new_resultset
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
Array.send :include, SimpleCov::ArrayMergeHelper
|
39
|
-
Hash.send :include, SimpleCov::HashMergeHelper
|
data/simplecov.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
$:.push File.expand_path('../lib', __FILE__)
|
3
|
-
require 'simplecov/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |gem|
|
6
|
-
gem.name = 'simplecov'
|
7
|
-
gem.version = SimpleCov::VERSION
|
8
|
-
gem.platform = Gem::Platform::RUBY
|
9
|
-
gem.authors = ["Christoph Olszowka"]
|
10
|
-
gem.email = ['christoph at olszowka de']
|
11
|
-
gem.homepage = 'http://github.com/colszowka/simplecov'
|
12
|
-
gem.description = %Q{Code coverage for Ruby 1.9 with a powerful configuration library and automatic merging of coverage across test suites}
|
13
|
-
gem.summary = gem.description
|
14
|
-
|
15
|
-
gem.add_dependency 'multi_json', '~> 1.0'
|
16
|
-
gem.add_dependency 'simplecov-html', '~> 0.5.3'
|
17
|
-
gem.add_development_dependency 'aruba'
|
18
|
-
gem.add_development_dependency 'capybara'
|
19
|
-
gem.add_development_dependency 'appraisal'
|
20
|
-
gem.add_development_dependency 'cucumber', '>= 1.1.4'
|
21
|
-
gem.add_development_dependency 'rake'
|
22
|
-
gem.add_development_dependency 'rspec'
|
23
|
-
gem.add_development_dependency 'shoulda'
|
24
|
-
|
25
|
-
gem.files = `git ls-files`.split("\n")
|
26
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
28
|
-
gem.require_paths = ['lib']
|
29
|
-
end
|
data/test/faked_project/Gemfile
DELETED
data/test/faked_project/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
-
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
-
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
|
5
|
-
interp_opts = if defined?(RUBY_ENGINE)
|
6
|
-
" --tags ~@exclude-#{RUBY_ENGINE}"
|
7
|
-
else
|
8
|
-
''
|
9
|
-
end
|
10
|
-
%>
|
11
|
-
default: <%= std_opts %><%= interp_opts %> features
|
12
|
-
wip: --tags @wip:30 --wip features<%= interp_opts %>
|
13
|
-
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip<%= interp_opts %>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Given /^I want to keep stuff simple$/ do
|
2
|
-
1.should == 1
|
3
|
-
end
|
4
|
-
|
5
|
-
When /^I write my cukes for the fake project$/ do
|
6
|
-
1.should == 1
|
7
|
-
end
|
8
|
-
|
9
|
-
Then /^I make all neccessary tests in a single step$/ do
|
10
|
-
FakedProject.foo.should == 'bar'
|
11
|
-
|
12
|
-
FrameworkSpecific.cucumber.should == "Only tested in Cucumber"
|
13
|
-
|
14
|
-
FakedProject.a_class_method.should == "this is a mixed-in class method"
|
15
|
-
|
16
|
-
FakedProject.new.an_instance_method.should == "this is a mixed-in instance method"
|
17
|
-
FakedProject.new.dynamic.should == "A dynamically defined instance method"
|
18
|
-
|
19
|
-
something = SomeClass.new("foo")
|
20
|
-
something.reverse.should == 'oof'
|
21
|
-
something.compare_with('foo').should be_true
|
22
|
-
end
|
23
|
-
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
|
3
|
-
# We're injecting simplecov_config via aruba in cucumber here
|
4
|
-
# depending on what the test case is...
|
5
|
-
begin
|
6
|
-
require File.join(File.dirname(__FILE__), 'simplecov_config')
|
7
|
-
rescue LoadError => err
|
8
|
-
$stderr.puts "No SimpleCov config file found!"
|
9
|
-
end
|
10
|
-
|
11
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../../lib'))
|
12
|
-
require 'faked_project'
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class FakedProject
|
2
|
-
def self.foo
|
3
|
-
"bar"
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
Dir[File.join(File.dirname(__FILE__), 'faked_project/*.rb')].each do |file|
|
8
|
-
require file # Require all source files in project dynamically so we can inject some stuff depending on test situation
|
9
|
-
end
|
10
|
-
|
11
|
-
FakedProject.send :include, MetaMagic
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# A pile of methods that only get tested in their frameworks
|
2
|
-
# and thus make this file only 100% covered when all framework test
|
3
|
-
# results are merged
|
4
|
-
module FrameworkSpecific
|
5
|
-
class << self
|
6
|
-
def cucumber
|
7
|
-
"Only tested in Cucumber"
|
8
|
-
end
|
9
|
-
|
10
|
-
def rspec
|
11
|
-
"Only tested in RSpec"
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_unit
|
15
|
-
"Only tested in Test/Unit"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module MetaMagic
|
2
|
-
module ClassMethods
|
3
|
-
def a_class_method
|
4
|
-
"this is a mixed-in class method"
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
module InstanceMethods
|
9
|
-
def an_instance_method
|
10
|
-
"this is a mixed-in instance method"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.included(base)
|
15
|
-
base.send :extend, ClassMethods
|
16
|
-
base.send :include, InstanceMethods
|
17
|
-
|
18
|
-
base.class_eval do
|
19
|
-
define_method :dynamic do
|
20
|
-
"A dynamically defined instance method"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
class SomeClass
|
2
|
-
attr_reader :label
|
3
|
-
attr_accessor :some_attr
|
4
|
-
|
5
|
-
def initialize(label)
|
6
|
-
@label = label
|
7
|
-
end
|
8
|
-
|
9
|
-
def reverse
|
10
|
-
label.reverse
|
11
|
-
end
|
12
|
-
|
13
|
-
def compare_with(item)
|
14
|
-
if item == label
|
15
|
-
return true
|
16
|
-
else
|
17
|
-
raise "Item does not match label"
|
18
|
-
end
|
19
|
-
|
20
|
-
rescue => err
|
21
|
-
false
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def uncovered
|
27
|
-
"private method"
|
28
|
-
end
|
29
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe FakedProject do
|
4
|
-
it "should have added a class method to FakedProject" do
|
5
|
-
FakedProject.a_class_method.should == "this is a mixed-in class method"
|
6
|
-
end
|
7
|
-
|
8
|
-
its(:an_instance_method) { should == "this is a mixed-in instance method" }
|
9
|
-
its(:dynamic) { should == "A dynamically defined instance method" }
|
10
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
|
3
|
-
# We're injecting simplecov_config via aruba in cucumber here
|
4
|
-
# depending on what the test case is...
|
5
|
-
begin
|
6
|
-
require File.join(File.dirname(__FILE__), 'simplecov_config')
|
7
|
-
rescue LoadError => err
|
8
|
-
$stderr.puts "No SimpleCov config file found!"
|
9
|
-
end
|
10
|
-
|
11
|
-
require 'faked_project'
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
# some (optional) config here
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class MetaMagicTest < Test::Unit::TestCase
|
4
|
-
def test_class_methods
|
5
|
-
assert_equal "this is a mixed-in class method", FakedProject.a_class_method
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_instance_methods
|
9
|
-
p = FakedProject.new
|
10
|
-
assert_equal "this is a mixed-in instance method", p.an_instance_method
|
11
|
-
assert_equal "A dynamically defined instance method", p.dynamic
|
12
|
-
end
|
13
|
-
end
|