From 7abb3156f89604d4985ac740387cc80fe54b3edb Mon Sep 17 00:00:00 2001 From: Andrey Marchenko Date: Tue, 19 Mar 2024 13:46:21 +0100 Subject: [PATCH] fix: cucumber-ruby 9.2 includes breaking change for Cucumber::Core::Test::Result --- gemfiles/jruby_9.4_cucumber_9.gemfile.lock | 30 +++++++++---------- gemfiles/ruby_2.7_cucumber_9.gemfile.lock | 30 +++++++++---------- gemfiles/ruby_3.0_cucumber_9.gemfile.lock | 30 +++++++++---------- gemfiles/ruby_3.1_cucumber_9.gemfile.lock | 30 +++++++++---------- gemfiles/ruby_3.2_cucumber_9.gemfile.lock | 30 +++++++++---------- gemfiles/ruby_3.3_cucumber_9.gemfile.lock | 30 +++++++++---------- lib/datadog/ci/contrib/cucumber/formatter.rb | 12 +++++++- sig/datadog/ci/contrib/cucumber/formatter.rbs | 2 ++ 8 files changed, 103 insertions(+), 91 deletions(-) diff --git a/gemfiles/jruby_9.4_cucumber_9.gemfile.lock b/gemfiles/jruby_9.4_cucumber_9.gemfile.lock index b676eea2..0014f530 100644 --- a/gemfiles/jruby_9.4_cucumber_9.gemfile.lock +++ b/gemfiles/jruby_9.4_cucumber_9.gemfile.lock @@ -16,31 +16,31 @@ GEM builder (3.2.4) climate_control (1.2.0) coderay (1.1.3) - cucumber (9.1.2) - builder (~> 3.2, >= 3.2.4) - cucumber-ci-environment (~> 9.2, >= 9.2.0) - cucumber-core (~> 12.0) + cucumber (9.2.0) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) cucumber-cucumber-expressions (~> 17.0) - cucumber-gherkin (> 24, < 27) + cucumber-gherkin (> 24, < 28) cucumber-html-formatter (> 20.3, < 22) cucumber-messages (> 19, < 25) diff-lcs (~> 1.5) - mini_mime (~> 1.1, >= 1.1.5) - multi_test (~> 1.1, >= 1.1.0) - sys-uname (~> 1.2, >= 1.2.3) - cucumber-ci-environment (9.2.0) - cucumber-core (12.0.0) - cucumber-gherkin (>= 25, < 27) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.1) + cucumber-gherkin (>= 27, < 28) cucumber-messages (>= 20, < 23) - cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-tag-expressions (> 5, < 7) cucumber-cucumber-expressions (17.0.2) bigdecimal - cucumber-gherkin (26.2.0) - cucumber-messages (>= 19.1.4, < 22.1) + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) cucumber-html-formatter (21.3.0) cucumber-messages (> 19, < 25) cucumber-messages (22.0.0) - cucumber-tag-expressions (5.0.6) + cucumber-tag-expressions (6.1.0) ddtrace (1.21.0) datadog-ci (~> 0.8.1) debase-ruby_core_source (= 3.3.1) diff --git a/gemfiles/ruby_2.7_cucumber_9.gemfile.lock b/gemfiles/ruby_2.7_cucumber_9.gemfile.lock index 579cab32..d9a8b600 100644 --- a/gemfiles/ruby_2.7_cucumber_9.gemfile.lock +++ b/gemfiles/ruby_2.7_cucumber_9.gemfile.lock @@ -16,31 +16,31 @@ GEM builder (3.2.4) climate_control (1.2.0) coderay (1.1.3) - cucumber (9.1.2) - builder (~> 3.2, >= 3.2.4) - cucumber-ci-environment (~> 9.2, >= 9.2.0) - cucumber-core (~> 12.0) + cucumber (9.2.0) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) cucumber-cucumber-expressions (~> 17.0) - cucumber-gherkin (> 24, < 27) + cucumber-gherkin (> 24, < 28) cucumber-html-formatter (> 20.3, < 22) cucumber-messages (> 19, < 25) diff-lcs (~> 1.5) - mini_mime (~> 1.1, >= 1.1.5) - multi_test (~> 1.1, >= 1.1.0) - sys-uname (~> 1.2, >= 1.2.3) - cucumber-ci-environment (9.2.0) - cucumber-core (12.0.0) - cucumber-gherkin (>= 25, < 27) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.1) + cucumber-gherkin (>= 27, < 28) cucumber-messages (>= 20, < 23) - cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-tag-expressions (> 5, < 7) cucumber-cucumber-expressions (17.0.2) bigdecimal - cucumber-gherkin (26.2.0) - cucumber-messages (>= 19.1.4, < 22.1) + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) cucumber-html-formatter (21.3.0) cucumber-messages (> 19, < 25) cucumber-messages (22.0.0) - cucumber-tag-expressions (5.0.6) + cucumber-tag-expressions (6.1.0) ddtrace (1.21.0) datadog-ci (~> 0.8.1) debase-ruby_core_source (= 3.3.1) diff --git a/gemfiles/ruby_3.0_cucumber_9.gemfile.lock b/gemfiles/ruby_3.0_cucumber_9.gemfile.lock index 579cab32..d9a8b600 100644 --- a/gemfiles/ruby_3.0_cucumber_9.gemfile.lock +++ b/gemfiles/ruby_3.0_cucumber_9.gemfile.lock @@ -16,31 +16,31 @@ GEM builder (3.2.4) climate_control (1.2.0) coderay (1.1.3) - cucumber (9.1.2) - builder (~> 3.2, >= 3.2.4) - cucumber-ci-environment (~> 9.2, >= 9.2.0) - cucumber-core (~> 12.0) + cucumber (9.2.0) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) cucumber-cucumber-expressions (~> 17.0) - cucumber-gherkin (> 24, < 27) + cucumber-gherkin (> 24, < 28) cucumber-html-formatter (> 20.3, < 22) cucumber-messages (> 19, < 25) diff-lcs (~> 1.5) - mini_mime (~> 1.1, >= 1.1.5) - multi_test (~> 1.1, >= 1.1.0) - sys-uname (~> 1.2, >= 1.2.3) - cucumber-ci-environment (9.2.0) - cucumber-core (12.0.0) - cucumber-gherkin (>= 25, < 27) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.1) + cucumber-gherkin (>= 27, < 28) cucumber-messages (>= 20, < 23) - cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-tag-expressions (> 5, < 7) cucumber-cucumber-expressions (17.0.2) bigdecimal - cucumber-gherkin (26.2.0) - cucumber-messages (>= 19.1.4, < 22.1) + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) cucumber-html-formatter (21.3.0) cucumber-messages (> 19, < 25) cucumber-messages (22.0.0) - cucumber-tag-expressions (5.0.6) + cucumber-tag-expressions (6.1.0) ddtrace (1.21.0) datadog-ci (~> 0.8.1) debase-ruby_core_source (= 3.3.1) diff --git a/gemfiles/ruby_3.1_cucumber_9.gemfile.lock b/gemfiles/ruby_3.1_cucumber_9.gemfile.lock index 579cab32..d9a8b600 100644 --- a/gemfiles/ruby_3.1_cucumber_9.gemfile.lock +++ b/gemfiles/ruby_3.1_cucumber_9.gemfile.lock @@ -16,31 +16,31 @@ GEM builder (3.2.4) climate_control (1.2.0) coderay (1.1.3) - cucumber (9.1.2) - builder (~> 3.2, >= 3.2.4) - cucumber-ci-environment (~> 9.2, >= 9.2.0) - cucumber-core (~> 12.0) + cucumber (9.2.0) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) cucumber-cucumber-expressions (~> 17.0) - cucumber-gherkin (> 24, < 27) + cucumber-gherkin (> 24, < 28) cucumber-html-formatter (> 20.3, < 22) cucumber-messages (> 19, < 25) diff-lcs (~> 1.5) - mini_mime (~> 1.1, >= 1.1.5) - multi_test (~> 1.1, >= 1.1.0) - sys-uname (~> 1.2, >= 1.2.3) - cucumber-ci-environment (9.2.0) - cucumber-core (12.0.0) - cucumber-gherkin (>= 25, < 27) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.1) + cucumber-gherkin (>= 27, < 28) cucumber-messages (>= 20, < 23) - cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-tag-expressions (> 5, < 7) cucumber-cucumber-expressions (17.0.2) bigdecimal - cucumber-gherkin (26.2.0) - cucumber-messages (>= 19.1.4, < 22.1) + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) cucumber-html-formatter (21.3.0) cucumber-messages (> 19, < 25) cucumber-messages (22.0.0) - cucumber-tag-expressions (5.0.6) + cucumber-tag-expressions (6.1.0) ddtrace (1.21.0) datadog-ci (~> 0.8.1) debase-ruby_core_source (= 3.3.1) diff --git a/gemfiles/ruby_3.2_cucumber_9.gemfile.lock b/gemfiles/ruby_3.2_cucumber_9.gemfile.lock index 579cab32..d9a8b600 100644 --- a/gemfiles/ruby_3.2_cucumber_9.gemfile.lock +++ b/gemfiles/ruby_3.2_cucumber_9.gemfile.lock @@ -16,31 +16,31 @@ GEM builder (3.2.4) climate_control (1.2.0) coderay (1.1.3) - cucumber (9.1.2) - builder (~> 3.2, >= 3.2.4) - cucumber-ci-environment (~> 9.2, >= 9.2.0) - cucumber-core (~> 12.0) + cucumber (9.2.0) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) cucumber-cucumber-expressions (~> 17.0) - cucumber-gherkin (> 24, < 27) + cucumber-gherkin (> 24, < 28) cucumber-html-formatter (> 20.3, < 22) cucumber-messages (> 19, < 25) diff-lcs (~> 1.5) - mini_mime (~> 1.1, >= 1.1.5) - multi_test (~> 1.1, >= 1.1.0) - sys-uname (~> 1.2, >= 1.2.3) - cucumber-ci-environment (9.2.0) - cucumber-core (12.0.0) - cucumber-gherkin (>= 25, < 27) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.1) + cucumber-gherkin (>= 27, < 28) cucumber-messages (>= 20, < 23) - cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-tag-expressions (> 5, < 7) cucumber-cucumber-expressions (17.0.2) bigdecimal - cucumber-gherkin (26.2.0) - cucumber-messages (>= 19.1.4, < 22.1) + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) cucumber-html-formatter (21.3.0) cucumber-messages (> 19, < 25) cucumber-messages (22.0.0) - cucumber-tag-expressions (5.0.6) + cucumber-tag-expressions (6.1.0) ddtrace (1.21.0) datadog-ci (~> 0.8.1) debase-ruby_core_source (= 3.3.1) diff --git a/gemfiles/ruby_3.3_cucumber_9.gemfile.lock b/gemfiles/ruby_3.3_cucumber_9.gemfile.lock index 0db3649a..cce19692 100644 --- a/gemfiles/ruby_3.3_cucumber_9.gemfile.lock +++ b/gemfiles/ruby_3.3_cucumber_9.gemfile.lock @@ -16,31 +16,31 @@ GEM builder (3.2.4) climate_control (1.2.0) coderay (1.1.3) - cucumber (9.1.2) - builder (~> 3.2, >= 3.2.4) - cucumber-ci-environment (~> 9.2, >= 9.2.0) - cucumber-core (~> 12.0) + cucumber (9.2.0) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) cucumber-cucumber-expressions (~> 17.0) - cucumber-gherkin (> 24, < 27) + cucumber-gherkin (> 24, < 28) cucumber-html-formatter (> 20.3, < 22) cucumber-messages (> 19, < 25) diff-lcs (~> 1.5) - mini_mime (~> 1.1, >= 1.1.5) - multi_test (~> 1.1, >= 1.1.0) - sys-uname (~> 1.2, >= 1.2.3) - cucumber-ci-environment (9.2.0) - cucumber-core (12.0.0) - cucumber-gherkin (>= 25, < 27) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.1) + cucumber-gherkin (>= 27, < 28) cucumber-messages (>= 20, < 23) - cucumber-tag-expressions (~> 5.0, >= 5.0.4) + cucumber-tag-expressions (> 5, < 7) cucumber-cucumber-expressions (17.0.2) bigdecimal - cucumber-gherkin (26.2.0) - cucumber-messages (>= 19.1.4, < 22.1) + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) cucumber-html-formatter (21.3.0) cucumber-messages (> 19, < 25) cucumber-messages (22.0.0) - cucumber-tag-expressions (5.0.6) + cucumber-tag-expressions (6.1.0) ddtrace (1.21.0) datadog-ci (~> 0.8.1) debase-ruby_core_source (= 3.3.1) diff --git a/lib/datadog/ci/contrib/cucumber/formatter.rb b/lib/datadog/ci/contrib/cucumber/formatter.rb index 885534ef..310e58ad 100644 --- a/lib/datadog/ci/contrib/cucumber/formatter.rb +++ b/lib/datadog/ci/contrib/cucumber/formatter.rb @@ -113,7 +113,7 @@ def test_suite_name(test_case) end def finish_span(span, result) - if !result.passed? && result.ok?(@config.strict) + if !result.passed? && ok?(result, @config.strict) span.skipped!(reason: result.message) elsif result.passed? span.passed! @@ -186,6 +186,16 @@ def extract_parameters_hash(test_case) nil end + def ok?(result, strict) + # in minor update in Cucumber 9.2.0, the arity of the `ok?` method changed + parameters = result.method(:ok?).parameters + if parameters == [[:opt, :be_strict]] + result.ok?(strict) + else + result.ok?(strict: strict) + end + end + def configuration Datadog.configuration.ci[:cucumber] end diff --git a/sig/datadog/ci/contrib/cucumber/formatter.rbs b/sig/datadog/ci/contrib/cucumber/formatter.rbs index 5dd1f869..1accd4a4 100644 --- a/sig/datadog/ci/contrib/cucumber/formatter.rbs +++ b/sig/datadog/ci/contrib/cucumber/formatter.rbs @@ -47,6 +47,8 @@ module Datadog def extract_parameters_hash: (untyped test_case) -> Hash[String, String]? + def ok?: (Cucumber::Core::Test::Result result, untyped strict) -> bool + def configuration: () -> untyped end end