Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
safafa committed Jan 3, 2024
1 parent 819e3a5 commit c14acfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ jobs:
name: Exceptions
- name: Run print_log task
run: bundle exec rake failing_specs_detector:print_log
- name: Get results
id: results
run: |
{
echo 'LOG<<EOF'
cat failing_specs_detector.txt
echo EOF
} >> $GITHUB_OUTPUT
- name: Print result
run: echo ${{ steps.results.outputs.LOG }}

9 changes: 5 additions & 4 deletions lib/failing_spec_detector/combiner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ class Combiner
def initialize(exceptions, failures)
@exceptions = exceptions
@failures = failures
@filename = 'failing_specs_detector.txt'
end

def combine
puts "Failing specs detector:\n\n\n"
File.write(@filename, "Failing specs detector:\n\n\n")
@exceptions.uniq.each do |exception|
puts "#{exception}:\n\n"
File.write(@filename, "#{exception}:\n\n", mode: 'a')
related_examples = @failures.select { |failure| failure.exception == exception }
next if related_examples.empty?

related_examples.each do |failure|
puts "#{failure.backtrace}:\n"
File.write(@filename, "#{failure.backtrace}:\n", mode: 'a')
end
puts "\n\n\n"
File.write(@filename, "\n\n\n", mode: 'a')
end
end
end
Expand Down

0 comments on commit c14acfb

Please sign in to comment.