Module: Datadog::CI::Contrib::RSpec::ExampleGroup::ClassMethods
- Defined in:
- lib/datadog/ci/contrib/rspec/example_group.rb
Overview
Instance methods for configuration
Instance Method Summary collapse
Instance Method Details
#run(reporter = ::RSpec::Core::NullReporter) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/datadog/ci/contrib/rspec/example_group.rb', line 18 def run(reporter = ::RSpec::Core::NullReporter) return super if ::RSpec.configuration.dry_run? && !datadog_configuration[:dry_run_enabled] return super unless datadog_configuration[:enabled] # skip the context hooks if all descendant example are going to be skipped # IMPORTANT: must happen before top_level? check because skipping hooks must happen # even if it is a nested context [:skip] = true if all_examples_skipped_by_datadog? # return early because we create Datadog::CI::TestSuite only for top-level example groups return super unless top_level? suite_name = "#{description} at #{file_path}" test_suite = test_visibility_component&.start_test_suite( suite_name, tags: { CI::Ext::Test::TAG_SOURCE_FILE => Git::LocalRepository.relative_to_root([:file_path]), CI::Ext::Test::TAG_SOURCE_START => [:line_number].to_s } ) success = super return success unless test_suite if success && test_suite.any_passed? test_suite.passed! elsif success test_suite.skipped! else test_suite.failed! end test_suite.finish success end |