diff_test 0.8.8 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30ebf53cd9e386268105985641fa99ddee89e06769ca244562f27b180fcac613
4
- data.tar.gz: 44896ebcebfd807e3a1881b62556fc406a4255018e1ebc71f274b178b6dd2cd7
3
+ metadata.gz: 0eb6d31f88ec71845c1da318d944b46bcb0d7c6b550b0bb9c936a4236cd4e802
4
+ data.tar.gz: 879e45fa217f327c095c4f1bccac3d7308df661a3735ba3a549cdc8550c4360c
5
5
  SHA512:
6
- metadata.gz: 1e2c4f1f1c463574d8a88878c43a8cbeb7b051b51efef2f6a0693314e2dceeb8aa13730a13087284b625833485def5e0b9823196a6c8aa57794cb69a494eb04d
7
- data.tar.gz: 6130dedb438ee5960d29cbee6153bc3fa3e2e85e6e049b7de1917fa122269916af869cf419933504b2f1060f360a4b8c6df2ccda26a909027b28a1bd1533a01e
6
+ metadata.gz: d935e9d4ebce09151f96d998b9aa7cfcd4adc3f8a5e45622b29e1e57a093184b39e98321392eab581b37c2a7b51f8927bbb99fb4df447896ced3f3e409868b3f
7
+ data.tar.gz: cf82343110711249ec65a56486a559ae899614e886f49faceea1c35020abc58758f438a87969db609f866171abe5228421e7e23f12fcd9170689cbe1c8e40580
data/README.md CHANGED
@@ -253,6 +253,3 @@ test/services/zoom_webhook_event_processor_test.rb
253
253
 
254
254
  overhead of const TracePoint and file path prefix native
255
255
  method_added/const_added
256
-
257
-
258
- # WRITE test for it setting time from previous successful run
@@ -55,7 +55,7 @@ module DiffTest
55
55
  test_name = self.name
56
56
 
57
57
  DiffTest::TestExecution.current = execution = DiffTest::TestExecution.new(test_file_path:, test_name:)
58
- should_run = execution.should_run?
58
+ should_run = DiffTest::ShouldRunDecider.should_run?(execution.id, system_test: true)
59
59
  DiffTest::TestSuiteExecution.current.ensure_application_eager_loaded! if should_run
60
60
  rescue => e
61
61
  DiffTest.error("An error ocurred while trying to create a test execution. Please report this issue.\nException: #{e}")
@@ -67,10 +67,11 @@ module DiffTest
67
67
  super
68
68
  else
69
69
  # Skip raises an exception too, which is handled by `capture_exception`
70
- capture_exceptions do
71
- skip("Impacted files have not changed. Skipping...")
70
+ time_it do
71
+ capture_exceptions do
72
+ skip("Impacted files have not changed. Skipping...")
73
+ end
72
74
  end
73
- self.time = execution.previous_runtime_s
74
75
  ::Minitest::Result.from(self)
75
76
  end
76
77
  ensure
@@ -14,7 +14,7 @@ module DiffTest
14
14
  end
15
15
 
16
16
  def skip_processing?
17
- !html? || chunked?
17
+ !DiffTest::TestExecution.current || !html? || chunked?
18
18
  end
19
19
 
20
20
  def chunked?
@@ -8,10 +8,9 @@ module DiffTest
8
8
  end
9
9
 
10
10
  def should_run?(test_id, system_test:)
11
- return { should_run: true } unless @test_executions_by_test
11
+ return true unless @test_executions_by_test
12
12
 
13
13
  previous_test_executions = @test_executions_by_test[test_id] || []
14
- previous_runtime_ms = nil
15
14
 
16
15
  # If there are any previous test executions run whose impacted files are the same as now
17
16
  # Assume its safe to skip
@@ -24,8 +23,6 @@ module DiffTest
24
23
  DiffTest::FileHashComputer.compute_relative(impacted_file_path) == file_hash
25
24
  end
26
25
  next false unless hashes_match
27
-
28
- previous_runtime_ms = previous_test_execution['runtime_ms']
29
26
  next true unless system_test
30
27
 
31
28
  test_suite_execution = @test_suite_executions_by_id[previous_test_execution['test_suite_execution_id'].to_s]
@@ -35,13 +32,8 @@ module DiffTest
35
32
  false
36
33
  end
37
34
 
38
- return { should_run: true } if ENV['DIFF_TEST_ALWAYS_RUN'] == '1'
39
-
40
- should_run = !has_previous_execution_with_no_impacted_changes
41
- {
42
- should_run:,
43
- previous_runtime_ms:,
44
- }
35
+ return true if ENV['DIFF_TEST_ALWAYS_RUN'] == '1'
36
+ !has_previous_execution_with_no_impacted_changes
45
37
  end
46
38
 
47
39
  def self.current
@@ -13,16 +13,9 @@ module DiffTest
13
13
  self.class.set(id, self)
14
14
  end
15
15
 
16
- def should_run_decider_result
17
- @should_run_decider_result ||= DiffTest::ShouldRunDecider.should_run?(id, system_test: system_test?)
18
- end
19
-
20
16
  def should_run?
21
- should_run_decider_result[:should_run]
22
- end
23
-
24
- def previous_runtime_s
25
- (should_run_decider_result[:previous_runtime_ms] / 1000.0) if should_run_decider_result[:previous_runtime_ms]
17
+ return @should_run unless @should_run.nil?
18
+ @should_run = DiffTest::ShouldRunDecider.should_run?(id, system_test: system_test?)
26
19
  end
27
20
 
28
21
  def save_payload
@@ -30,7 +23,7 @@ module DiffTest
30
23
  test: id,
31
24
  result: @result,
32
25
  runtime_ms: runtime_ms,
33
- impacted_files: (@impacted_file_tracker.save_payload if successful?),
26
+ impacted_files: (@impacted_file_tracker.save_payload if passed?),
34
27
  }.compact
35
28
  end
36
29
 
@@ -73,14 +66,6 @@ module DiffTest
73
66
  @result == :passed
74
67
  end
75
68
 
76
- def skipped?
77
- @result == :skipped
78
- end
79
-
80
- def successful?
81
- passed? || skipped?
82
- end
83
-
84
69
  def runtime_ms
85
70
  return 0 if @stopped_at.nil? || @started_at.nil?
86
71
  (@stopped_at - @started_at) * 1000
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiffTest
4
- VERSION = "0.8.8"
4
+ VERSION = "0.8.9"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diff_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owais
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-26 00:00:00.000000000 Z
11
+ date: 2025-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty