Skip to content

Commit

Permalink
Handle missing source in dependencies
Browse files Browse the repository at this point in the history
Some GEMs provide functions that internally create their own examples, e.g. rswag's 'run_test!' internally defines examples.
In these cases, no source file will be found and even if resolved to the GEM's function, it would make no sense as an execution point.
  • Loading branch information
amartins23 committed Oct 31, 2024
1 parent 568c5e7 commit 5881df8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/rspec_tracer/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ def register_example_file_dependency(example_id, file_name)

source_file = RSpecTracer::SourceFile.from_name(file_name)

# some Gems provide functions that create their own examples
# e.g. rswag's 'run_test!' internally defines examples
# in these cases, no source file will be found
return if source_file.nil?

@reporter.register_source_file(source_file)
@reporter.register_dependency(example_id, file_name)
end
Expand Down

0 comments on commit 5881df8

Please sign in to comment.