Skip to content

Commit

Permalink
don't report test suite source locations when test suite is an anonym…
Browse files Browse the repository at this point in the history
…ous class in minitest
  • Loading branch information
anmarchenko committed Sep 24, 2024
1 parent ff0f32a commit c1fdf81
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/datadog/ci/contrib/minitest/runnable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ def run(*args)
test_suite_name = Helpers.test_suite_name(self, method)
source_file, line_number = Helpers.extract_source_location_from_class(self)

test_suite = test_visibility_component.start_test_suite(
test_suite_name,
tags: {
test_suite_tags = if source_file
{
CI::Ext::Test::TAG_SOURCE_FILE => (Git::LocalRepository.relative_to_root(source_file) if source_file),
CI::Ext::Test::TAG_SOURCE_START => line_number&.to_s
}
else
{}
end

test_suite = test_visibility_component.start_test_suite(
test_suite_name,
tags: test_suite_tags
)

results = super
Expand Down

0 comments on commit c1fdf81

Please sign in to comment.