deep-cover 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e42b3434b8b6263b660025dc15bb7247aff9d874
4
- data.tar.gz: 070d3144cbaad64ffa807b17722a62fd810e7455
3
+ metadata.gz: e164c802351be75ed8094fb9fe6d2a93d2928ccc
4
+ data.tar.gz: 5ec49dbb3275309c8585dc2ae919c75ac36b4cfb
5
5
  SHA512:
6
- metadata.gz: 77d1fd07c736c0045b554998b8448ea5c193af69e8cfe3c067b024d28afed61de22ebe5f5036df03664bb0ad2cbfe18a4c73b66d8fbc9b88dad52a52191d50d7
7
- data.tar.gz: e16eeb31a67a181fda812a07332831ec58c4d3232147864315e33d0542137bccd1dd51e35a4a8f8db84063da8f68ca49082bfb75f6a69ed93f37270e06093bb0
6
+ metadata.gz: f38996b4c6804ea7f56e7ae31254ef741607684b48bcecb22bfc37d42a68a8ebc7f2e635e14f2d7ab77b42c6eed959f4eac6419d0e37841bd1d66fc3f9442a88
7
+ data.tar.gz: 06fa0ffb32772c5c6303acee40999336920f743ee9eef3202bd66006de5e1dc46077666f41dce453e97b563ec9fa46a47e27d36595c1df5028df643a01bb5b08
data/.rspec CHANGED
@@ -1,3 +1,4 @@
1
1
  --color
2
2
  --exclude-pattern "spec/cli_fixtures/**/*.rb, spec/full_usage/**/*.rb"
3
+ --tag ~slow
3
4
  --tag ~skip
data/.rspec_all ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --exclude-pattern "spec/cli_fixtures/**/*.rb, spec/full_usage/**/*.rb"
3
+ --tag ~skip
data/.travis.yml CHANGED
@@ -12,6 +12,8 @@ before_install:
12
12
  - npm install -g nyc
13
13
  before_script:
14
14
  - rake dev:install
15
- matrix:
16
- allow_failures:
17
- - rvm: jruby-9.1.9.0
15
+ script:
16
+ - rake test:all
17
+ # matrix:
18
+ # allow_failures:
19
+ # - rvm: jruby-9.1.9.0
data/Rakefile CHANGED
@@ -8,7 +8,14 @@ RuboCop::RakeTask.new
8
8
 
9
9
  RSpec::Core::RakeTask.new(:spec).tap { |task| task.pattern = 'spec/*_spec.rb, spec/*/*_spec.rb' }
10
10
 
11
+ desc 'Run all tests'
12
+ RSpec::Core::RakeTask.new('spec:all') do |task|
13
+ task.pattern = 'spec/*_spec.rb, spec/*/*_spec.rb'
14
+ task.rspec_opts = '-O .rspec_all'
15
+ end
16
+
11
17
  multitask default: RUBY_VERSION > '2.1' ? [:rubocop, :spec] : :spec
18
+ multitask 'test:all' => RUBY_VERSION > '2.1' ? [:rubocop, 'spec:all'] : 'spec:all'
12
19
 
13
20
  namespace :dev do
14
21
  desc 'Setup extra things required to run the spec suite'
@@ -20,7 +20,7 @@ module DeepCover
20
20
  end
21
21
 
22
22
  def node_runs_map
23
- each_node.map do |node, sub_statements|
23
+ each_node.map do |node|
24
24
  [node, node_runs(node)]
25
25
  end.to_h
26
26
  end
@@ -34,15 +34,14 @@ module DeepCover
34
34
  # Yields the node and it's children (within the subset)
35
35
  def each_node(from = covered_code.root, &block)
36
36
  return to_enum(:each_node) unless block_given?
37
- children = node_children(from)
38
37
  begin
39
- yield from, children unless from.is_a?(Node::Root)
38
+ yield from unless from.is_a?(Node::Root)
40
39
  rescue ProblemWithDiagnostic
41
40
  raise
42
41
  rescue StandardError, SystemStackError => e
43
42
  raise ProblemWithDiagnostic.new(covered_code, from.diagnostic_expression, e)
44
43
  end
45
- children.each do |child|
44
+ node_children(from).each do |child|
46
45
  each_node(child, &block)
47
46
  end
48
47
  end
@@ -8,7 +8,7 @@ module DeepCover
8
8
  SUBSET_CLASSES = [Node::Branch].freeze
9
9
 
10
10
  def results
11
- each_node.map do |node, _children|
11
+ each_node.map do |node|
12
12
  branches_runs = node.branches.map { |b| [b, node_runs(b)] }.to_h
13
13
  [node, branches_runs]
14
14
  end.to_h
@@ -7,7 +7,7 @@ module DeepCover
7
7
  def results
8
8
  buffer = covered_code.buffer
9
9
  bc = buffer.source_lines.map { |line| '-' * line.size }
10
- each_node do |node, _children|
10
+ each_node do |node|
11
11
  runs = node_runs(node)
12
12
  next if runs == nil
13
13
  node.proper_range.each do |pos|
@@ -6,7 +6,7 @@ module DeepCover
6
6
  def results
7
7
  disallow_partial = !options.fetch(:allow_partial, true)
8
8
  line_hits = Array.new(covered_code.nb_lines + covered_code.lineno - 1)
9
- each_node do |node, _children|
9
+ each_node do |node|
10
10
  next unless (runs = node_runs(node))
11
11
  node.executed_locs.each do |loc|
12
12
  lineno = loc.line - 1
@@ -7,7 +7,7 @@ module DeepCover
7
7
  include Analyser::Subset
8
8
  # Returns a map of Range => runs
9
9
  def results
10
- each_node.map do |node, _sub_statements|
10
+ each_node.map do |node|
11
11
  [node.expression, node_runs(node)]
12
12
  end.to_h
13
13
  end
@@ -42,6 +42,7 @@ module DeepCover
42
42
  o.string '-c', '--command', 'command to run tests', default: 'bundle exec rake'
43
43
  o.bool '--bundle', 'run bundle before the tests', default: true
44
44
  o.bool '--process', 'turn off to only redo the reporting', default: true
45
+ o.bool '--open', 'open the output coverage', default: false
45
46
  o.separator 'Coverage options'
46
47
  @ignore_uncovered_map = Analyser.optionally_covered.map do |option|
47
48
  default = Config::DEFAULTS[:ignore_uncovered].include?(option)
@@ -76,10 +77,9 @@ module DeepCover
76
77
  show_help
77
78
  elsif options[:expression]
78
79
  Debugger.new(options[:expression], **options).show
79
- elsif (path = menu.arguments.first)
80
- InstrumentedCloneReporter.new(path, **options).run
81
80
  else
82
- show_help
81
+ path = menu.arguments.first || '.'
82
+ InstrumentedCloneReporter.new(path, **options).run
83
83
  end
84
84
  end
85
85
  end
@@ -59,9 +59,14 @@ module DeepCover
59
59
  dir = output_istanbul(**options).dirname
60
60
  unless [nil, '', 'false'].include? output
61
61
  output = File.expand_path(output)
62
- html = "--reporter=html --report-dir='#{output}' && open '#{output}/index.html'"
62
+ html = "--reporter=html --report-dir='#{output}'"
63
+ if options[:open]
64
+ html += " && open '#{output}/index.html'"
65
+ else
66
+ msg = "\nHTML coverage written to: '#{output}/index.html'"
67
+ end
63
68
  end
64
- `cd #{dir} && nyc report --reporter=text #{html}`
69
+ `cd #{dir} && nyc report --reporter=text #{html}` + msg.to_s
65
70
  end
66
71
 
67
72
  def basic_report
@@ -24,7 +24,6 @@ module DeepCover
24
24
  has_tracker :default
25
25
  has_child name: Symbol
26
26
  has_child default: Node, flow_entry_count: :default_tracker_hits, rewrite: '(%{default_tracker};%{node})'
27
- executed_loc_keys :name, :operator
28
27
 
29
28
  def executable?
30
29
  false
@@ -20,6 +20,7 @@ module DeepCover
20
20
  end
21
21
 
22
22
  def executed_loc_keys
23
+ return [] unless executable?
23
24
  loc_hash.keys - [:expression]
24
25
  end
25
26
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepCover
4
- VERSION = '0.1.15'
4
+ VERSION = '0.1.16'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep-cover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-André Lafortune
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-11-14 00:00:00.000000000 Z
12
+ date: 2017-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parser
@@ -218,6 +218,7 @@ extra_rdoc_files: []
218
218
  files:
219
219
  - ".gitignore"
220
220
  - ".rspec"
221
+ - ".rspec_all"
221
222
  - ".rubocop.yml"
222
223
  - ".travis.yml"
223
224
  - CODE_OF_CONDUCT.md