rspec-tracer 0.6.1 → 0.6.2

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
  SHA256:
3
- metadata.gz: 4dff7e48382045aef3821a6f863521c9f74823b5bbd12c16b09c41b47277124e
4
- data.tar.gz: cff630db632b7fa96be3d3de675b994325f815c69613b84d891bc8313688ab67
3
+ metadata.gz: a86a9027964446fd10fc51379221d718e15699f6f93ba0c56af654273ccf632d
4
+ data.tar.gz: 1ade4a1b9a14b8cf0a10467889e0631d4b4e30871118734a6d2b4705138b19b2
5
5
  SHA512:
6
- metadata.gz: 83348356f2a12e930d73cec63e867a13ffab85e428696fc3d91dfeab5a691bac4641d848330d0225e08bc7156d0902faffc8ecd8f4a8871b24c093513c6a8b0d
7
- data.tar.gz: 2cc9084dbeb9ca0fa26997b33b486360e3c1fe8b7efbb91f28b3a1786bf0e966b32f75b5d7b98a3488c5ced8d1704005f1c1a5972e876e25d3877a40d8068379
6
+ metadata.gz: c251e47b35e667c0b847c54bb7a7c96ad33c39b8c91f48bcaf96c06cb9b017155ed760398f24e382ee93c94fe8bf7b40289fd9c87518bbd467d42b2bae91daac
7
+ data.tar.gz: a314d23f2b7998cb64b5183a5a0da4d1d100039accfd28998ccdf15d451f633fb4181688951de400bbaf82095253f56d73e585632e411657ada157d0e285a1b0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.6.2] - 2021-09-07
2
+
3
+ ### Added
4
+
5
+ Improvements towards reducing dependency and coverage processing time (#26)
6
+
1
7
  ## [0.6.1] - 2021-09-06
2
8
 
3
9
  ### Fixed
data/README.md CHANGED
@@ -71,7 +71,7 @@ integrating the gem into your project to better understand what is happening.
71
71
 
72
72
  Add this line to your `Gemfile` and `bundle install`:
73
73
  ```ruby
74
- gem 'rspec-tracer', group: :test, require: false
74
+ gem 'rspec-tracer', version: '~> 0.6', group: :test, require: false
75
75
  ```
76
76
 
77
77
  And, add the followings to your `.gitignore`:
@@ -29,11 +29,15 @@ module RSpecTracer
29
29
 
30
30
  def compute_diff(example_id)
31
31
  peek_coverage.each_pair do |file_path, current_stats|
32
- if @coverage.key?(file_path)
33
- existing_file_diff_coverage(example_id, file_path, current_stats)
34
- else
32
+ unless @coverage.key?(file_path)
35
33
  missing_file_diff_coverage(example_id, file_path, current_stats)
34
+
35
+ next
36
36
  end
37
+
38
+ next if current_stats == @coverage[file_path]
39
+
40
+ existing_file_diff_coverage(example_id, file_path, current_stats)
37
41
  end
38
42
  end
39
43
 
@@ -229,56 +229,56 @@ module RSpecTracer
229
229
  def write_all_examples_report
230
230
  file_name = File.join(@cache_dir, 'all_examples.json')
231
231
 
232
- File.write(file_name, JSON.generate(@all_examples))
232
+ File.write(file_name, JSON.pretty_generate(@all_examples))
233
233
  end
234
234
 
235
235
  def write_flaky_examples_report
236
236
  file_name = File.join(@cache_dir, 'flaky_examples.json')
237
237
 
238
- File.write(file_name, JSON.generate(@flaky_examples.to_a))
238
+ File.write(file_name, JSON.pretty_generate(@flaky_examples.to_a))
239
239
  end
240
240
 
241
241
  def write_failed_examples_report
242
242
  file_name = File.join(@cache_dir, 'failed_examples.json')
243
243
 
244
- File.write(file_name, JSON.generate(@failed_examples.to_a))
244
+ File.write(file_name, JSON.pretty_generate(@failed_examples.to_a))
245
245
  end
246
246
 
247
247
  def write_pending_examples_report
248
248
  file_name = File.join(@cache_dir, 'pending_examples.json')
249
249
 
250
- File.write(file_name, JSON.generate(@pending_examples.to_a))
250
+ File.write(file_name, JSON.pretty_generate(@pending_examples.to_a))
251
251
  end
252
252
 
253
253
  def write_all_files_report
254
254
  file_name = File.join(@cache_dir, 'all_files.json')
255
255
 
256
- File.write(file_name, JSON.generate(@all_files))
256
+ File.write(file_name, JSON.pretty_generate(@all_files))
257
257
  end
258
258
 
259
259
  def write_dependency_report
260
260
  file_name = File.join(@cache_dir, 'dependency.json')
261
261
 
262
- File.write(file_name, JSON.generate(@dependency))
262
+ File.write(file_name, JSON.pretty_generate(@dependency))
263
263
  end
264
264
 
265
265
  def write_reverse_dependency_report
266
266
  file_name = File.join(@cache_dir, 'reverse_dependency.json')
267
267
 
268
- File.write(file_name, JSON.generate(@reverse_dependency))
268
+ File.write(file_name, JSON.pretty_generate(@reverse_dependency))
269
269
  end
270
270
 
271
271
  def write_examples_coverage_report
272
272
  file_name = File.join(@cache_dir, 'examples_coverage.json')
273
273
 
274
- File.write(file_name, JSON.generate(@examples_coverage))
274
+ File.write(file_name, JSON.pretty_generate(@examples_coverage))
275
275
  end
276
276
 
277
277
  def write_last_run_report
278
278
  file_name = File.join(RSpecTracer.cache_path, 'last_run.json')
279
279
  last_run_data = @last_run.merge(run_id: @run_id, timestamp: Time.now.utc)
280
280
 
281
- File.write(file_name, JSON.generate(last_run_data))
281
+ File.write(file_name, JSON.pretty_generate(last_run_data))
282
282
  end
283
283
  end
284
284
  end
@@ -90,16 +90,15 @@ module RSpecTracer
90
90
  # rubocop:enable Metrics/AbcSize
91
91
 
92
92
  def register_dependency(examples_coverage)
93
+ filtered_files = Set.new
94
+
93
95
  examples_coverage.each_pair do |example_id, example_coverage|
94
96
  register_example_files_dependency(example_id)
95
97
 
96
98
  example_coverage.each_key do |file_path|
97
- source_file = RSpecTracer::SourceFile.from_path(file_path)
98
-
99
- next if RSpecTracer.filters.any? { |filter| filter.match?(source_file) }
99
+ next if filtered_files.include?(file_path)
100
100
 
101
- @reporter.register_source_file(source_file)
102
- @reporter.register_dependency(example_id, source_file[:file_name])
101
+ filtered_files << file_path unless register_file_dependency(example_id, file_path)
103
102
  end
104
103
  end
105
104
 
@@ -260,6 +259,17 @@ module RSpecTracer
260
259
  @reporter.register_dependency(example_id, file_name)
261
260
  end
262
261
 
262
+ def register_file_dependency(example_id, file_path)
263
+ source_file = RSpecTracer::SourceFile.from_path(file_path)
264
+
265
+ return false if RSpecTracer.filters.any? { |filter| filter.match?(source_file) }
266
+
267
+ @reporter.register_source_file(source_file)
268
+ @reporter.register_dependency(example_id, source_file[:file_name])
269
+
270
+ true
271
+ end
272
+
263
273
  def generate_examples_status_report
264
274
  starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
265
275
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecTracer
4
- VERSION = '0.6.1'
4
+ VERSION = '0.6.2'
5
5
  end
data/lib/rspec_tracer.rb CHANGED
@@ -250,7 +250,7 @@ module RSpecTracer
250
250
  }
251
251
  }
252
252
 
253
- File.write(file_name, JSON.generate(report))
253
+ File.write(file_name, JSON.pretty_generate(report))
254
254
  end
255
255
 
256
256
  def print_coverage_stats(file_name, elpased)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhimanyu Singh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-06 00:00:00.000000000 Z
11
+ date: 2021-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docile
@@ -107,7 +107,7 @@ licenses:
107
107
  - MIT
108
108
  metadata:
109
109
  homepage_uri: https://github.com/avmnu-sng/rspec-tracer
110
- source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v0.6.1
110
+ source_code_uri: https://github.com/avmnu-sng/rspec-tracer/tree/v0.6.2
111
111
  changelog_uri: https://github.com/avmnu-sng/rspec-tracer/blob/main/CHANGELOG.md
112
112
  bug_tracker_uri: https://github.com/avmnu-sng/rspec-tracer/issues
113
113
  post_install_message: