diff_test 0.2.0
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 +7 -0
- data/.standard.yml +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +208 -0
- data/Rakefile +10 -0
- data/lib/diff_test/api_client.rb +38 -0
- data/lib/diff_test/configuration.rb +178 -0
- data/lib/diff_test/file_hash_computer.rb +21 -0
- data/lib/diff_test/helper.rb +37 -0
- data/lib/diff_test/impacted_file_tracker.rb +34 -0
- data/lib/diff_test/integrations/integration.rb +29 -0
- data/lib/diff_test/integrations/minitest/integration.rb +26 -0
- data/lib/diff_test/integrations/minitest/lifecycle.rb +77 -0
- data/lib/diff_test/integrations/rails_js/annotator.rb +43 -0
- data/lib/diff_test/integrations/rails_js/body_processor.rb +69 -0
- data/lib/diff_test/integrations/rails_js/integration.rb +25 -0
- data/lib/diff_test/integrations/rails_js/js_files.rake +48 -0
- data/lib/diff_test/integrations/rails_js/middleware.rb +43 -0
- data/lib/diff_test/integrations/rails_js/processing_skip_analyzer.rb +31 -0
- data/lib/diff_test/integrations/rails_js/railtie.rb +17 -0
- data/lib/diff_test/js_version_hash_computer.rb +24 -0
- data/lib/diff_test/project_version_hash_computer.rb +26 -0
- data/lib/diff_test/should_run_decider.rb +44 -0
- data/lib/diff_test/test_execution.rb +92 -0
- data/lib/diff_test/test_suite_execution.rb +114 -0
- data/lib/diff_test/trackers/base.rb +23 -0
- data/lib/diff_test/trackers/js_file.rb +7 -0
- data/lib/diff_test/trackers/ruby_file.rb +50 -0
- data/lib/diff_test/trackers/singleton_base.rb +43 -0
- data/lib/diff_test/version.rb +5 -0
- data/lib/diff_test.rb +32 -0
- data/sig/diff_test.rbs +4 -0
- metadata +107 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
module DiffTest
|
3
|
+
module Trackers
|
4
|
+
class SingletonBase < DiffTest::Trackers::Base
|
5
|
+
def self.active_instances
|
6
|
+
@_active_instances ||= Set.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.recordable_path(path)
|
10
|
+
path = path&.to_s
|
11
|
+
path = DiffTest::Helper.expand_path(path)
|
12
|
+
return unless DiffTest::Helper.file_in_project?(path)
|
13
|
+
|
14
|
+
DiffTest::Helper.relative_path_from_project_root(path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.record(path)
|
18
|
+
recordable_path = self.recordable_path(path)
|
19
|
+
return unless recordable_path
|
20
|
+
|
21
|
+
puts "DiffTest: Recording #{recordable_path} but no active instances" if active_instances.empty?
|
22
|
+
active_instances.each do |instance|
|
23
|
+
instance.record(recordable_path)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.record_by_test_id(test_id, path)
|
28
|
+
recordable_path = self.recordable_path(path)
|
29
|
+
return unless recordable_path
|
30
|
+
|
31
|
+
DiffTest::TestExecution.get(test_id).impacted_file_tracker.trackers.find { |tracker| tracker.class == self }.record(recordable_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
def enable
|
35
|
+
self.class.active_instances.add(self)
|
36
|
+
end
|
37
|
+
|
38
|
+
def disable
|
39
|
+
self.class.active_instances.delete(self)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/diff_test.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'diff_test/version'
|
4
|
+
require_relative 'diff_test/configuration'
|
5
|
+
require_relative 'diff_test/helper'
|
6
|
+
require_relative 'diff_test/api_client'
|
7
|
+
require_relative 'diff_test/test_suite_execution'
|
8
|
+
require_relative 'diff_test/test_execution'
|
9
|
+
require_relative 'diff_test/impacted_file_tracker'
|
10
|
+
require_relative 'diff_test/integrations/minitest/integration'
|
11
|
+
require_relative 'diff_test/integrations/rails_js/integration'
|
12
|
+
|
13
|
+
module DiffTest
|
14
|
+
class Error < StandardError; end
|
15
|
+
module_function
|
16
|
+
|
17
|
+
def self.configuration
|
18
|
+
@configuration ||= DiffTest::Configuration.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.configure
|
22
|
+
self.configuration ||= DiffTest::Configuration.new
|
23
|
+
yield(configuration)
|
24
|
+
end
|
25
|
+
|
26
|
+
def integrate!
|
27
|
+
DiffTest::Integrations::RailsJs::Integration.instance.integrate_if_ready unless ENV['DONT_INTEGRATE_DIFF_TEST']
|
28
|
+
DiffTest::Integrations::Minitest::Integration.instance.integrate_if_ready unless ENV['DONT_INTEGRATE_DIFF_TEST']
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
DiffTest.integrate!
|
data/sig/diff_test.rbs
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: diff_test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Owais
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-03-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.17'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: xxhash
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.6.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.6.0
|
41
|
+
description: Improve your tests execution by only running tests which are affected
|
42
|
+
by your changes.
|
43
|
+
email:
|
44
|
+
- owaiswiz@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".standard.yml"
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/diff_test.rb
|
54
|
+
- lib/diff_test/api_client.rb
|
55
|
+
- lib/diff_test/configuration.rb
|
56
|
+
- lib/diff_test/file_hash_computer.rb
|
57
|
+
- lib/diff_test/helper.rb
|
58
|
+
- lib/diff_test/impacted_file_tracker.rb
|
59
|
+
- lib/diff_test/integrations/integration.rb
|
60
|
+
- lib/diff_test/integrations/minitest/integration.rb
|
61
|
+
- lib/diff_test/integrations/minitest/lifecycle.rb
|
62
|
+
- lib/diff_test/integrations/rails_js/annotator.rb
|
63
|
+
- lib/diff_test/integrations/rails_js/body_processor.rb
|
64
|
+
- lib/diff_test/integrations/rails_js/integration.rb
|
65
|
+
- lib/diff_test/integrations/rails_js/js_files.rake
|
66
|
+
- lib/diff_test/integrations/rails_js/middleware.rb
|
67
|
+
- lib/diff_test/integrations/rails_js/processing_skip_analyzer.rb
|
68
|
+
- lib/diff_test/integrations/rails_js/railtie.rb
|
69
|
+
- lib/diff_test/js_version_hash_computer.rb
|
70
|
+
- lib/diff_test/project_version_hash_computer.rb
|
71
|
+
- lib/diff_test/should_run_decider.rb
|
72
|
+
- lib/diff_test/test_execution.rb
|
73
|
+
- lib/diff_test/test_suite_execution.rb
|
74
|
+
- lib/diff_test/trackers/base.rb
|
75
|
+
- lib/diff_test/trackers/js_file.rb
|
76
|
+
- lib/diff_test/trackers/ruby_file.rb
|
77
|
+
- lib/diff_test/trackers/singleton_base.rb
|
78
|
+
- lib/diff_test/version.rb
|
79
|
+
- sig/diff_test.rbs
|
80
|
+
homepage: https://github.com/owaiswiz/diff_test
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata:
|
84
|
+
homepage_uri: https://github.com/owaiswiz/diff_test
|
85
|
+
source_code_uri: https://github.com/owaiswiz/diff_test
|
86
|
+
changelog_uri: https://github.com/owaiswiz/diff_test/releases
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 3.0.0
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubygems_version: 3.5.9
|
103
|
+
signing_key:
|
104
|
+
specification_version: 4
|
105
|
+
summary: Improve your tests execution by only running tests which are affected by
|
106
|
+
your changes.
|
107
|
+
test_files: []
|