flakey_spec_catcher 0.10.0 → 0.11.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1be370079a94e8f578e03be6e8683cd76ff8d1f5656422427c8ca3920856b38c
|
4
|
+
data.tar.gz: 6dddff4adf5e7f452a366bff7b67a50e8e4a04e64a9165c80e9318235afcae33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b49520ad8fe8a9115ae04bf90c93159694c0bcbbae087acaa9953aac26927b61efb68e3531d9097ea86b5b60d8bf6f84df685baf6798c95bcd0f5e560c752af5
|
7
|
+
data.tar.gz: 927b24f3283dfdd8575c3210a560c21a63f315bc98ada713390b15ac1d3dea0773534d761bf51ca5216eaee03567f7602e50615dc85fdab52620ab78ea456070
|
@@ -8,7 +8,7 @@ module FlakeySpecCatcher
|
|
8
8
|
# A ChangeCapsule object will represent the changes made to a block of code. It
|
9
9
|
# accomplishes this using ChangeContext and ChangeSummary objects.
|
10
10
|
class ChangeCapsule
|
11
|
-
attr_reader :file_name, :change_summary, :change_contexts
|
11
|
+
attr_reader :file_name, :change_summary, :change_contexts, :spec_tree
|
12
12
|
SCOPE_SPECIFIERS = %w[it context describe scenario].freeze
|
13
13
|
SHARED_EXAMPLES = %w[include_examples it_behaves_like it_should_behave_like matching].freeze
|
14
14
|
|
@@ -16,6 +16,7 @@ module FlakeySpecCatcher
|
|
16
16
|
@file_name = file_name
|
17
17
|
@change_summary = change_summary
|
18
18
|
@change_contexts = []
|
19
|
+
@spec_tree = {}
|
19
20
|
handle_initial_change_contexts(change_contexts)
|
20
21
|
end
|
21
22
|
|
@@ -112,6 +113,20 @@ module FlakeySpecCatcher
|
|
112
113
|
|
113
114
|
change_context_stack.push(change_context) unless
|
114
115
|
change_context_stack.any? { |c| c == change_context }
|
116
|
+
|
117
|
+
build_spec_tree(change_context_stack)
|
118
|
+
end
|
119
|
+
|
120
|
+
def build_spec_tree(change_contexts)
|
121
|
+
return unless change_contexts.count > 1
|
122
|
+
|
123
|
+
current_scope = change_contexts[-1].rerun_info
|
124
|
+
parent_scope = change_contexts[-2].rerun_info
|
125
|
+
@spec_tree[parent_scope] = if @spec_tree[parent_scope]
|
126
|
+
@spec_tree[parent_scope] << current_scope
|
127
|
+
else
|
128
|
+
[current_scope]
|
129
|
+
end
|
115
130
|
end
|
116
131
|
end
|
117
132
|
end
|
@@ -9,6 +9,7 @@ module FlakeySpecCatcher
|
|
9
9
|
class CliOverride
|
10
10
|
attr_reader :rerun_patterns, :rerun_usage, :repeat_factor, :enable_runs, :excluded_tags, :use_parent, :dry_run
|
11
11
|
attr_reader :output_file, :split_nodes, :split_index, :verbose, :test_options, :break_on_first_failure
|
12
|
+
attr_reader :list_child_specs
|
12
13
|
|
13
14
|
def initialize
|
14
15
|
@dry_run = false
|
@@ -60,6 +61,10 @@ module FlakeySpecCatcher
|
|
60
61
|
@break_on_first_failure = break_on_first_failure
|
61
62
|
end
|
62
63
|
|
64
|
+
opts.on('--list-child-specs', 'List Child Specs (Verbose Spec Listing') do |list_child_specs|
|
65
|
+
@list_child_specs = list_child_specs
|
66
|
+
end
|
67
|
+
|
63
68
|
opts.on('-e', '--excluded-tags=EXCLUDED_TAGS',
|
64
69
|
'Specify tags to exclude in a comma separated list') do |tags|
|
65
70
|
@excluded_tags = parse_tags(tags)
|
@@ -39,6 +39,7 @@ module FlakeySpecCatcher
|
|
39
39
|
else
|
40
40
|
all_non_example_groups - identify_tag_excluded_reruns
|
41
41
|
end
|
42
|
+
tests = transform_parent_specs(tests).flatten if @user_config.list_child_specs
|
42
43
|
filter_reruns_by_ignore_files(tests)
|
43
44
|
end
|
44
45
|
|
@@ -171,5 +172,23 @@ module FlakeySpecCatcher
|
|
171
172
|
@rerun_capsules.push(FlakeySpecCatcher::RerunCapsule.new(testcase: testcase, usage: usage))
|
172
173
|
end
|
173
174
|
end
|
175
|
+
|
176
|
+
def transform_parent_specs(tests)
|
177
|
+
transformed_tests = []
|
178
|
+
tests.each do |test|
|
179
|
+
capsule = @git_controller.capsule_manager.change_capsules.find { |c| c.file_name == test.split(':')[0] }
|
180
|
+
spec_tree = capsule.spec_tree
|
181
|
+
# If test is a key in the spec_tree, it's an example group, so we queue up its descendant examples
|
182
|
+
if spec_tree[test]
|
183
|
+
spec_tree[test].each do |child|
|
184
|
+
transformed_tests << transform_parent_specs([child]).flatten
|
185
|
+
end
|
186
|
+
# Else test is just an example
|
187
|
+
else
|
188
|
+
transformed_tests << test
|
189
|
+
end
|
190
|
+
end
|
191
|
+
transformed_tests
|
192
|
+
end
|
174
193
|
end
|
175
194
|
end
|
@@ -12,11 +12,11 @@ module FlakeySpecCatcher
|
|
12
12
|
attr_reader :manual_rerun_patterns, :manual_rerun_usage
|
13
13
|
attr_reader :enable_runs, :output_file, :use_parent, :dry_run
|
14
14
|
attr_reader :split_nodes, :split_index, :verbose, :test_options
|
15
|
-
attr_reader :break_on_first_failure
|
15
|
+
attr_reader :break_on_first_failure, :list_child_specs
|
16
16
|
|
17
17
|
USER_CONFIG_ENV_VARS = %w[FSC_REPEAT_FACTOR FSC_IGNORE_FILES FSC_IGNORE_BRANCHES
|
18
18
|
FSC_SILENT_MODE FSC_RERUN_FILE_ONLY FSC_USAGE_PATTERNS
|
19
|
-
FSC_EXCLUDED_TAGS FSC_OUTPUT_FILE].freeze
|
19
|
+
FSC_EXCLUDED_TAGS FSC_OUTPUT_FILE FSC_LIST_CHILD_SPECS].freeze
|
20
20
|
|
21
21
|
def initialize(cli_override: CliOverride.new)
|
22
22
|
apply_env_var_settings
|
@@ -33,6 +33,7 @@ module FlakeySpecCatcher
|
|
33
33
|
@ignore_branches = env_var_string_to_array(ENV['FSC_IGNORE_BRANCHES'])
|
34
34
|
@silent_mode = env_var_string_to_bool(ENV['FSC_SILENT_MODE'])
|
35
35
|
@rerun_file_only = env_var_string_to_bool(ENV['FSC_RERUN_FILE_ONLY'])
|
36
|
+
@list_child_specs = env_var_string_to_bool(ENV['FSC_LIST_CHILD_SPECS'])
|
36
37
|
@rspec_usage_patterns = env_var_string_to_pairs(ENV['FSC_USAGE_PATTERNS'])
|
37
38
|
@excluded_tags = env_var_string_to_tags(ENV['FSC_EXCLUDED_TAGS'])
|
38
39
|
@output_file = ENV['FSC_OUTPUT_FILE']
|
@@ -46,6 +47,7 @@ module FlakeySpecCatcher
|
|
46
47
|
@use_parent = @cli_override.use_parent
|
47
48
|
@repeat_factor = @cli_override.repeat_factor if @cli_override.repeat_factor.to_i.positive?
|
48
49
|
@break_on_first_failure = @cli_override.break_on_first_failure
|
50
|
+
@list_child_specs = @cli_override.list_child_specs unless @cli_override.list_child_specs.nil?
|
49
51
|
@enable_runs = @cli_override.enable_runs
|
50
52
|
@dry_run = @cli_override.dry_run
|
51
53
|
@split_nodes = @cli_override.split_nodes unless @cli_override.split_nodes.nil?
|
@@ -170,7 +172,7 @@ module FlakeySpecCatcher
|
|
170
172
|
end
|
171
173
|
end
|
172
174
|
|
173
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
175
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
174
176
|
def override_user_config(env_var, env_value)
|
175
177
|
case env_var
|
176
178
|
when 'FSC_REPEAT_FACTOR'
|
@@ -183,6 +185,8 @@ module FlakeySpecCatcher
|
|
183
185
|
@silent_mode = env_var_string_to_bool(env_value)
|
184
186
|
when 'FSC_RERUN_FILE_ONLY'
|
185
187
|
@rerun_file_only = env_var_string_to_bool(env_value)
|
188
|
+
when 'FSC_LIST_CHILD_SPECS'
|
189
|
+
@list_child_specs = env_var_string_to_bool(env_value)
|
186
190
|
when 'FSC_USAGE_PATTERNS'
|
187
191
|
@rspec_usage_patterns = env_var_string_to_pairs(env_value)
|
188
192
|
when 'FSC_EXCLUDED_TAGS'
|
@@ -191,6 +195,6 @@ module FlakeySpecCatcher
|
|
191
195
|
@output_file = env_value
|
192
196
|
end
|
193
197
|
end
|
194
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
198
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
195
199
|
end
|
196
200
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flakey_spec_catcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Watson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|