Skip to content

Commit f693124

Browse files
committed
streamline by allowing to collect errors for an indivual file
1 parent 0fd9fc1 commit f693124

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

app/helpers/test_executions_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def info_title_for_product_test(product_test)
112112

113113
# returns [file_name, error_result]
114114
def file_name_and_error_result_from_execution(execution)
115-
errs = Cypress::ErrorCollector.collected_errors(execution)
115+
errs = Cypress::ErrorCollector.collected_errors(execution, file_name: params[:file_name])
116116
files = errs.files.select { |file_name, _| route_file_name(file_name) == params[:file_name] }
117117
file_name_and_error_result_from_files(files, params[:file_name])
118118
end

lib/cypress/error_collector.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ class FileNotFound < StandardError
66
end
77

88
# include_locations (default true) to include the xml locations mapping with collected errors
9-
def self.collected_errors(execution, include_locations: true)
9+
def self.collected_errors(execution, include_locations: true, file_name: nil)
1010
# gonna return all the errors for this execution, structured in a reasonable way.
1111
collected_errors = { nonfile: get_nonfile_errors(execution), files: {} }
1212
execution.artifact.file_names.each do |this_name|
13+
next unless file_name.nil? || file_name == ApplicationController.helpers.route_file_name(this_name)
14+
1315
all_errs = execution.execution_errors.by_file(this_name.force_encoding('UTF-8'))
1416
related_errs = execution.sibling_execution ? execution.sibling_execution.execution_errors.by_file(this_name) : [] # c3
1517
next unless (all_errs.count + related_errs.count).positive?

0 commit comments

Comments
 (0)