diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f07d8109..1b6411e05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) for more info on how to contribute to Cucumber. ## [Unreleased] +### Added +- Add timestamp to `Attachment` message ## [10.2.0] - 2025-12-10 ### Changed diff --git a/compatibility/cck_spec.rb b/compatibility/cck_spec.rb index d904dbf3f..efb938d7f 100644 --- a/compatibility/cck_spec.rb +++ b/compatibility/cck_spec.rb @@ -3,7 +3,7 @@ require_relative 'support/shared_examples' require_relative 'support/cck/examples' -require 'cck/examples' +require 'cucumber/compatibility_kit' # This is the implementation of the CCK testing for cucumber-ruby # It will run each example from the CCK that is of type "gherkin" (As "markdown" examples aren't implemented in ruby) @@ -13,13 +13,19 @@ describe CCK, :cck do let(:cucumber_command) { 'bundle exec cucumber --publish-quiet --profile none --format message' } - CCK::Examples.gherkin.each do |example_name| + ['retry', 'ambiguous'].each do |example_name| describe "'#{example_name}' example" do include_examples 'cucumber compatibility kit' do let(:example) { example_name } - let(:extra_args) { example == 'retry' ? '--retry 2' : '' } + let(:extra_args) do + if File.exist?("#{cck_path}/#{example}.arguments.txt") + File.read("#{cck_path}/#{example}.arguments.txt").to_s + else + '' + end + end let(:support_code_path) { CCK::Examples.supporting_code_for(example) } - let(:messages) { `#{cucumber_command} #{extra_args} --require #{support_code_path} #{cck_path}` } + let(:messages) { `#{cucumber_command} --require #{support_code_path} #{cck_path} #{extra_args}` } end end end diff --git a/compatibility/features/ambiguous/ambiguous_steps.rb b/compatibility/features/ambiguous/ambiguous_steps.rb new file mode 100644 index 000000000..21161e30d --- /dev/null +++ b/compatibility/features/ambiguous/ambiguous_steps.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +Given(/^a (.*?) with (.*?)$/) do |_arg1, _arg2| + # no-op +end + +Given(/^a step with (.*)$/) do |_arg1| + # no-op +end diff --git a/compatibility/features/doc-strings/doc-strings_steps.rb b/compatibility/features/doc-strings/doc-strings_steps.rb new file mode 100644 index 000000000..a374b1c40 --- /dev/null +++ b/compatibility/features/doc-strings/doc-strings_steps.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Given('a doc string:') do |doc_string| + # no-op +end diff --git a/compatibility/features/global-hooks-afterall-error/global-hooks-afterall-error_steps.rb b/compatibility/features/global-hooks-afterall-error/global-hooks-afterall-error_steps.rb new file mode 100644 index 000000000..d72047878 --- /dev/null +++ b/compatibility/features/global-hooks-afterall-error/global-hooks-afterall-error_steps.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +BeforeAll do + # no-op +end + +BeforeAll do + raise 'BeforeAll hook went wrong' +end + +BeforeAll do + # no-op +end + +When('a step passes') do + # no-op +end + +AfterAll do + # no-op +end + +AfterAll do + # no-op +end diff --git a/compatibility/features/global-hooks-attachments/global-hooks-attachments_steps.rb b/compatibility/features/global-hooks-attachments/global-hooks-attachments_steps.rb new file mode 100644 index 000000000..b2c272529 --- /dev/null +++ b/compatibility/features/global-hooks-attachments/global-hooks-attachments_steps.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +BeforeAll do + attach('Attachment from BeforeAll hook', 'text/plain') +end + +When('a step passes') do + # no-op +end + +AfterAll do + attach('Attachment from AfterAll hook', 'text/plain') +end diff --git a/compatibility/features/global-hooks-beforeall-error/global-hooks-beforeall-error_steps.rb b/compatibility/features/global-hooks-beforeall-error/global-hooks-beforeall-error_steps.rb new file mode 100644 index 000000000..bca4571e4 --- /dev/null +++ b/compatibility/features/global-hooks-beforeall-error/global-hooks-beforeall-error_steps.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +BeforeAll do + # no-op +end + +BeforeAll do + # no-op +end + +When('a step passes') do + # no-op +end + +AfterAll do + # no-op +end + +AfterAll do + raise 'AfterAll hook went wrong' +end + +AfterAll do + # no-op +end diff --git a/compatibility/features/global-hooks/global-hooks_steps.rb b/compatibility/features/global-hooks/global-hooks_steps.rb new file mode 100644 index 000000000..993bc62c5 --- /dev/null +++ b/compatibility/features/global-hooks/global-hooks_steps.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +BeforeAll do + # no-op +end + +BeforeAll do + # no-op +end + +When('a step passes') do + # no-op +end + +When('a step fails') do + raise 'Exception in step' +end + +AfterAll do + # no-op +end + +AfterAll do + # no-op +end diff --git a/compatibility/features/multiple-features-reversed/multiple-features-reversed_steps.rb b/compatibility/features/multiple-features-reversed/multiple-features-reversed_steps.rb new file mode 100644 index 000000000..cd8682ffe --- /dev/null +++ b/compatibility/features/multiple-features-reversed/multiple-features-reversed_steps.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Given('an order for {string}') do |_item| + # no-op +end diff --git a/compatibility/features/multiple-features/multiple-features_steps.rb b/compatibility/features/multiple-features/multiple-features_steps.rb new file mode 100644 index 000000000..cd8682ffe --- /dev/null +++ b/compatibility/features/multiple-features/multiple-features_steps.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Given('an order for {string}') do |_item| + # no-op +end diff --git a/compatibility/features/regular-expression/regular-expression_steps.rb b/compatibility/features/regular-expression/regular-expression_steps.rb new file mode 100644 index 000000000..246e6e3e0 --- /dev/null +++ b/compatibility/features/regular-expression/regular-expression_steps.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Given(/^a (.*?)(?: and a (.*?))?(?: and a (.*?))?$/) do |_vegetable1, _vegetable2, _vegetable3| + # no-op +end diff --git a/compatibility/features/retry/retry_steps.rb b/compatibility/features/retry/retry_steps.rb index c31a0aa63..d042e9304 100644 --- a/compatibility/features/retry/retry_steps.rb +++ b/compatibility/features/retry/retry_steps.rb @@ -19,3 +19,15 @@ Given('a step that always fails') do raise 'Exception in step' end + +Given('an ambiguous step') do + # first one +end + +Given('an ambiguous step') do + # second one +end + +Given('a pending step') do + pending('') +end diff --git a/compatibility/features/rules-backgrounds/rules-backgrounds_steps.rb b/compatibility/features/rules-backgrounds/rules-backgrounds_steps.rb new file mode 100644 index 000000000..3b5187169 --- /dev/null +++ b/compatibility/features/rules-backgrounds/rules-backgrounds_steps.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +Given('an order for {string}') do |_item| + # no-op +end + +When('an action') do + # no-op +end + +Then('an outcome') do + # no-op +end diff --git a/compatibility/features/unused-steps/unused-steps_steps.rb b/compatibility/features/unused-steps/unused-steps_steps.rb new file mode 100644 index 000000000..f06fdfa5f --- /dev/null +++ b/compatibility/features/unused-steps/unused-steps_steps.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +Given('a step that is used') do + # no-op +end + +Given('a step that is not used') do + # no-op +end diff --git a/compatibility/support/shared_examples.rb b/compatibility/support/shared_examples.rb index a9ebf8a99..6f2674dbe 100644 --- a/compatibility/support/shared_examples.rb +++ b/compatibility/support/shared_examples.rb @@ -10,7 +10,7 @@ RSpec.shared_examples 'cucumber compatibility kit' do include CCK::Helpers - let(:cck_path) { CCK::Examples.feature_code_for(example) } + let(:cck_path) { CompatibilityKit.feature_code_for(example) } let(:parsed_original) { parse_ndjson_file("#{cck_path}/#{example}.ndjson") } let(:parsed_generated) { parse_ndjson(messages) } diff --git a/cucumber.gemspec b/cucumber.gemspec index 8162a1dfb..bbf926516 100644 --- a/cucumber.gemspec +++ b/cucumber.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |s| s.add_dependency 'multi_test', '~> 1.1' s.add_dependency 'sys-uname', '~> 1.3' - s.add_development_dependency 'cucumber-compatibility-kit', '~> 20.0' + s.add_development_dependency 'cucumber-compatibility-kit', '~> 22.0' # Only needed whilst we are testing the formatters. Can be removed once we remove tests for those s.add_development_dependency 'nokogiri', '~> 1.15' s.add_development_dependency 'rake', '~> 13.2'