Skip to content

V10: Update dependencies #1782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3120dc1
Unrestrict runtime deps
luke-hill Feb 28, 2025
0fac6b5
Remove rubocop-capybara as its no longer needed or suggested and slig…
luke-hill Feb 28, 2025
b91f20c
Slight tidy to interceptor spec
luke-hill Feb 28, 2025
4129214
Update CCK testing version
luke-hill Feb 28, 2025
583b9ca
Downgrade CCK to v17 whilst investigating issues
luke-hill Feb 28, 2025
90c9233
WIP for adding id to test run id
luke-hill Feb 28, 2025
3475155
Merge branch 'main' into refactor/unrestrict_deps_for_v10
luke-hill Apr 15, 2025
8e89a56
Fix duplicate testing block
luke-hill Apr 15, 2025
64798de
Run release pipeline tests on 3.4 also
luke-hill Apr 15, 2025
244bc1b
Update docs
luke-hill Apr 15, 2025
4258906
Minor simplification to main runtime
luke-hill Apr 15, 2025
0857499
Fix bug with deprecator message
luke-hill Apr 15, 2025
21fea7a
Fix deprecator spec
luke-hill Apr 15, 2025
bdb9be1
Minor tidy to backtrace filter
luke-hill May 8, 2025
a033db0
Change ID generation to be much simpler - Add this to output envelope…
luke-hill May 8, 2025
392292f
Remove redundant input event when finding / generating test run id
luke-hill May 8, 2025
3ecca70
Add Test run ID to test case ready event
luke-hill May 8, 2025
6d38517
Add test run started id to testrunfinished message
luke-hill May 8, 2025
b783edb
Hook refactors
luke-hill May 8, 2025
4b6a5b4
Downgrade CCK back to 16.2 and hardcode cck tests to just retry
luke-hill May 16, 2025
88ea676
Recommit v17 of CCK
luke-hill May 16, 2025
9a2bc8e
Experiment move TestCaseReadyEvent lower down
luke-hill May 16, 2025
cf3d717
Re-run all CCK tests again;
luke-hill May 16, 2025
9f0ba59
Change to CCK steps for v18 conformance
luke-hill May 16, 2025
fc670f9
Update to v18 of cck
luke-hill May 16, 2025
ec79d5f
Triage one failing test
luke-hill May 16, 2025
e7ae78a
Bugfix wrong media type
luke-hill May 16, 2025
deae018
Add in deprecated steps for CCK conformance (currently)
luke-hill May 16, 2025
59d450b
Add in truffleruby guard for some tests
luke-hill May 16, 2025
8e7f9e8
Hard code the truffleruby test to use v24
luke-hill May 16, 2025
9027061
Add truffleruby 24 into release pipeline
luke-hill May 16, 2025
cfc7e86
Fix rubocop
luke-hill May 16, 2025
b70c543
Compress a few lines down
luke-hill May 16, 2025
62a8fa4
Re-test the whole of the CCK again
luke-hill May 21, 2025
a38c2d9
Clarify deprecation notice for CCK attachment steps
luke-hill May 21, 2025
5b56ad6
Remove redundant require for testrunstarted query
luke-hill May 21, 2025
bb99b55
Fix missing arg in step
luke-hill May 21, 2025
87d439f
Tidy up of lines / style
luke-hill May 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ruby: ['3.0', '3.1', '3.2', '3.3']
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
include:
- os: ubuntu-latest
ruby: jruby-9.4
- os: ubuntu-latest
ruby: truffleruby-24
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- os: ubuntu-latest
ruby: jruby-9.4
- os: ubuntu-latest
ruby: truffleruby-head
ruby: truffleruby-24
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 0 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ inherit_mode:
- Exclude

require:
- rubocop-capybara
- rubocop-packaging
- rubocop-rake
- rubocop-rspec
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ All logic contained in [compatibility](./compatibility) ([luke-hill](https://git

## [9.1.0] - 2023-11-14
### Changed
- First couple of passes of tidying up approximately 40% of the manual fix cops
- First iteration to tidy up approximately 40% of the manual fix cops
([#1739](https://github.com/cucumber/cucumber-ruby/pull/1739) [#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [#1741](https://github.com/cucumber/cucumber-ruby/pull/1741) [#1742](https://github.com/cucumber/cucumber-ruby/pull/1742) [luke-hill](https://github.com/luke-hill))
- Removed a bunch of example files / sample projects from ancient projects no longer viable
([#1740](https://github.com/cucumber/cucumber-ruby/pull/1740) [luke-hill](https://github.com/luke-hill))
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ Later in this document, bundler is considered being used so all commands are usi

### Supported platforms

- Ruby 3.4
- Ruby 3.3
- Ruby 3.2
- Ruby 3.1
- Ruby 3.0
- Ruby 2.7
- TruffleRuby 22.0.0+
- JRuby 9.4+ (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))

Expand Down Expand Up @@ -91,12 +92,11 @@ Feature: Rule Sample
Given this will fail
When I do an action
Then some results should be there

```

### Automate your specification

And a file named `steps.rb` in `features/step_definitions` with:
And a file named `rule_steps.rb` in `features/step_definitions` with:

```ruby
# features/step_definitions/steps.rb
Expand Down Expand Up @@ -149,4 +149,4 @@ You can also find documentation on the command line possibilities in [features/d

## Copyright

Copyright (c) Cucumber Ltd. and Contributors. See LICENSE for details.
Copyright (c) Cucumber and Contributors. See LICENSE for details.
10 changes: 0 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
See [.github/RELEASING](https://github.com/cucumber/.github/blob/main/RELEASING.md).

## When done ##

Update the cucumber-ruby version in the documentation project:

* https://github.com/cucumber/docs.cucumber.io

The cucumber-ruby version for the docs is specified in the docs [versions.yaml](https://github.com/cucumber/docs.cucumber.io/blob/master/data/versions.yaml)

All done! Hurray!
4 changes: 3 additions & 1 deletion compatibility/features/attachments/attachments_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ def cck_asset_path
attach(data, media_type)
end

# To be removed in CCK v19 alongside removing duplicate scenarios: https://github.com/cucumber/compatibility-kit/pull/127
When('a JPEG image is attached') do
attach(File.open("#{cck_asset_path}/cucumber.jpeg"), 'image/jpeg')
end

# To be removed in CCK v19 alongside removing duplicate scenarios: https://github.com/cucumber/compatibility-kit/pull/127
When('a PNG image is attached') do
attach(File.open("#{cck_asset_path}/cucumber.png"), 'image/png')
end

When('a PDF document is attached and renamed') do
attach(File.open("#{cck_asset_path}/document.pdf"), 'document/pdf', 'renamed.pdf')
attach(File.open("#{cck_asset_path}/document.pdf"), 'application/pdf', 'renamed.pdf')
end

When('a link to {string} is attached') do |link|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

def cck_asset_path
"#{Gem.loaded_specs['cucumber-compatibility-kit'].full_gem_path}/features/examples-tables-attachment"
end

When('a JPEG image is attached') do
attach(File.open("#{cck_asset_path}/cucumber.jpeg"), 'image/jpeg')
end

When('a PNG image is attached') do
attach(File.open("#{cck_asset_path}/cucumber.png"), 'image/png')
end
17 changes: 17 additions & 0 deletions compatibility/features/hooks-attachment/hooks-attachment_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

def cck_asset_path
"#{Gem.loaded_specs['cucumber-compatibility-kit'].full_gem_path}/features/hooks-attachment"
end

Before do
attach(File.open("#{cck_asset_path}/cucumber.svg"), 'image/svg+xml')
end

After do
attach(File.open("#{cck_asset_path}/cucumber.svg"), 'image/svg+xml')
end

When('a step passes') do
# no-op
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

Before('@passing-hook') do
# no-op
end

Before('@fail-before') do
raise 'Exception in conditional hook'
end

When('a step passes') do
# no-op
end

After('@passing-hook') do
# no-op
end

After('@fail-after') do
raise 'Exception in conditional hook'
end
13 changes: 13 additions & 0 deletions compatibility/features/hooks-named/hooks-named_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

Before(name: 'A named before hook') do
# no-op
end

When('a step passes') do
# no-op
end

After(name: 'A named after hook') do
# no-op
end
16 changes: 0 additions & 16 deletions compatibility/features/hooks/hooks_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
# no-op
end

Before(name: 'A named hook') do
# no-op
end

def cck_asset_path
"#{Gem.loaded_specs['cucumber-compatibility-kit'].full_gem_path}/features/hooks"
end

When('a step passes') do
# no-op
end
Expand All @@ -23,11 +15,3 @@ def cck_asset_path
After do
# no-op
end

After('@some-tag or @some-other-tag') do
raise 'Exception in conditional hook'
end

After('@with-attachment') do
attach(File.open("#{cck_asset_path}/cucumber.svg"), 'image/svg+xml')
end
11 changes: 5 additions & 6 deletions cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,24 @@ Gem::Specification.new do |s|
s.add_dependency 'base64', '~> 0.2'
s.add_dependency 'builder', '~> 3.2'
s.add_dependency 'cucumber-ci-environment', '> 9', '< 11'
s.add_dependency 'cucumber-core', '~> 15.0'
s.add_dependency 'cucumber-cucumber-expressions', '~> 17.0'
s.add_dependency 'cucumber-core', '> 15', '< 17'
s.add_dependency 'cucumber-cucumber-expressions', '> 17', '< 19'
s.add_dependency 'cucumber-html-formatter', '> 20.3', '< 22'
s.add_dependency 'diff-lcs', '~> 1.5'
s.add_dependency 'logger', '~> 1.6'
s.add_dependency 'mini_mime', '~> 1.1'
s.add_dependency 'multi_test', '~> 1.1'
s.add_dependency 'sys-uname', '~> 1.3'

s.add_development_dependency 'cucumber-compatibility-kit', '~> 16.2'
s.add_development_dependency 'cucumber-compatibility-kit', '~> 18.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'
s.add_development_dependency 'rspec', '~> 3.13'
s.add_development_dependency 'rubocop', '~> 1.69.2'
s.add_development_dependency 'rubocop-capybara', '~> 2.21.0'
s.add_development_dependency 'rubocop', '~> 1.71.0'
s.add_development_dependency 'rubocop-packaging', '~> 0.5.2'
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
s.add_development_dependency 'rubocop-rspec', '~> 3.3.0'
s.add_development_dependency 'rubocop-rspec', '~> 3.4.0'
s.add_development_dependency 'simplecov', '~> 0.22.0'
s.add_development_dependency 'webrick', '~> 1.8'

Expand Down
3 changes: 1 addition & 2 deletions lib/cucumber/cli/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ def trap_interrupt
def runtime(existing_runtime)
return Runtime.new(configuration) unless existing_runtime

existing_runtime.configure(configuration)
existing_runtime
existing_runtime.tap { |runtime| runtime.configure(configuration) }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/deprecate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module Cucumber
def self.deprecate(message, method, remove_after_version)
$stderr.puts(
"\nWARNING: ##{method} is deprecated" \
"\nWARNING: #{method} is deprecated" \
" and will be removed after version #{remove_after_version}. #{message}.\n" \
"(Called from #{caller(3..3).first})"
)
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/filters/broadcast_test_case_ready_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Cucumber
module Filters
class BroadcastTestCaseReadyEvent < Core::Filter.new(:config)
def test_case(test_case)
config.notify :test_case_ready, test_case
config.notify(:test_case_ready, test_case)
test_case.describe_to(receiver)
end
end
Expand Down
31 changes: 25 additions & 6 deletions lib/cucumber/formatter/backtrace_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,43 @@ def initialize(exception)
def exception
return @exception if ::Cucumber.use_full_backtrace

pwd_pattern = /#{::Regexp.escape(::Dir.pwd)}\//m
backtrace = @exception.backtrace.map { |line| line.gsub(pwd_pattern, './') }

filtered = (backtrace || []).reject do |line|
line =~ BACKTRACE_FILTER_PATTERNS
end

if ::ENV['CUCUMBER_TRUNCATE_OUTPUT']
# Strip off file locations
regexp = RUBY_VERSION >= '3.4' ? /(.*):in '/ : /(.*):in `/
filtered = filtered.map do |line|
match = regexp.match(line)
# Strip off file locations
match = regexp_filter.match(line)
match ? match[1] : line
end
end

@exception.set_backtrace(filtered)
@exception
@exception.tap { |e| e.set_backtrace(filtered) }
end

private

def pwd_pattern
/#{::Regexp.escape(::Dir.pwd)}\//m
end

def regexp_filter
ruby_greater_than_three_four? ? three_four_filter : three_three_filter
end

def ruby_greater_than_three_four?
RUBY_VERSION.to_f >= 3.4
end

def three_four_filter
/(.*):in '/
end

def three_three_filter
/(.*):in `/
end
end
end
Expand Down
14 changes: 11 additions & 3 deletions lib/cucumber/formatter/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require 'cucumber/formatter/query/pickle_step_by_test_step'
require 'cucumber/formatter/query/step_definitions_by_test_step'
require 'cucumber/formatter/query/test_case_started_by_test_case'
require 'cucumber/formatter/query/test_run_started'

module Cucumber
module Formatter
Expand All @@ -21,6 +22,7 @@ def initialize(config)
@pickle_step_by_test_step = Query::PickleStepByTestStep.new(config)
@step_definitions_by_test_step = Query::StepDefinitionsByTestStep.new(config)
@test_case_started_by_test_case = Query::TestCaseStartedByTestCase.new(config)
@test_run_started = Query::TestRunStarted.new(config)

config.on_event :envelope, &method(:on_envelope)
config.on_event :gherkin_source_read, &method(:on_gherkin_source_read)
Expand All @@ -34,6 +36,7 @@ def initialize(config)
config.on_event :undefined_parameter_type, &method(:on_undefined_parameter_type)

@test_case_by_step_id = {}
@current_test_run_started_id = nil
@current_test_case_started_id = nil
@current_test_step_id = nil
end
Expand Down Expand Up @@ -94,7 +97,8 @@ def on_test_case_ready(event)
test_case: Cucumber::Messages::TestCase.new(
id: event.test_case.id,
pickle_id: @pickle_by_test.pickle_id(event.test_case),
test_steps: event.test_case.test_steps.map { |step| test_step_to_message(step) }
test_steps: event.test_case.test_steps.map { |step| test_step_to_message(step) },
test_run_started_id: @current_test_run_started_id
)
)

Expand Down Expand Up @@ -150,9 +154,12 @@ def parameter_type_name(step_match_argument)
end

def on_test_run_started(*)
@current_test_run_started_id = @test_run_started.id

message = Cucumber::Messages::Envelope.new(
test_run_started: Cucumber::Messages::TestRunStarted.new(
timestamp: time_to_timestamp(Time.now)
timestamp: time_to_timestamp(Time.now),
id: @current_test_run_started_id
)
)

Expand Down Expand Up @@ -245,7 +252,8 @@ def on_test_run_finished(event)
message = Cucumber::Messages::Envelope.new(
test_run_finished: Cucumber::Messages::TestRunFinished.new(
timestamp: time_to_timestamp(Time.now),
success: event.success
success: event.success,
test_run_started_id: @current_test_run_started_id
)
)

Expand Down
17 changes: 17 additions & 0 deletions lib/cucumber/formatter/query/test_run_started.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module Cucumber
module Formatter
module Query
class TestRunStarted
def initialize(config)
@config = config
end

def id
@id ||= @config.id_generator.new_id
end
end
end
end
end
4 changes: 2 additions & 2 deletions lib/cucumber/glue/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def build_rb_world_factory(world_modules, namespaced_world_modules, proc)
@rb_language.build_rb_world_factory(world_modules, namespaced_world_modules, proc)
end

def register_rb_hook(phase, tag_names, proc, name: nil)
@rb_language.register_rb_hook(phase, tag_names, proc, name: name)
def register_rb_hook(type, tag_names, proc, name: nil)
@rb_language.register_rb_hook(type, tag_names, proc, name: name)
end

def define_parameter_type(parameter_type)
Expand Down
Loading
Loading