Skip to content

Commit

Permalink
Fix skip spec execution on error exit (crystal-lang#13986)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Nov 21, 2023
1 parent cb727c1 commit f8fafc3
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/spec/dsl.cr
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,23 @@ module Spec
def self.run
@@start_time = Time.monotonic

at_exit do
log_setup
maybe_randomize
run_filters
root_context.run
rescue ex
STDERR.print "Unhandled exception: "
ex.inspect_with_backtrace(STDERR)
STDERR.flush
@@aborted = true
ensure
finish_run
at_exit do |status|
# Do not run specs if the process is exiting on an error
next unless status == 0

begin
log_setup
maybe_randomize
run_filters
root_context.run
rescue ex
STDERR.print "Unhandled exception: "
ex.inspect_with_backtrace(STDERR)
STDERR.flush
@@aborted = true
ensure
finish_run
end
end
end

Expand Down

0 comments on commit f8fafc3

Please sign in to comment.