Module: Datadog::CI::Contrib::RSpec::Runner::InstanceMethods

Defined in:
lib/datadog/ci/contrib/rspec/runner.rb

Instance Method Summary collapse

Instance Method Details

#run_specs(example_groups) ⇒ Object



17
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
# File 'lib/datadog/ci/contrib/rspec/runner.rb', line 17

def run_specs(example_groups)
  return super unless configuration[:enabled]

  test_session = CI.start_test_session(
    tags: {
      CI::Ext::Test::TAG_FRAMEWORK => Ext::FRAMEWORK,
      CI::Ext::Test::TAG_FRAMEWORK_VERSION => CI::Contrib::RSpec::Integration.version.to_s,
      CI::Ext::Test::TAG_TYPE => CI::Ext::Test::TEST_TYPE
    },
    service: configuration[:service_name]
  )

  test_module = CI.start_test_module(test_session.name)

  result = super

  if result != 0
    # TODO: repeating this twice feels clunky, we need to remove test_module API before GA
    test_module.failed!
    test_session.failed!
  else
    test_module.passed!
    test_session.passed!
  end
  test_module.finish
  test_session.finish

  result
end