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 13 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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
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!
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', '~> 17.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
13 changes: 11 additions & 2 deletions lib/cucumber/formatter/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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 +35,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 @@ -149,10 +151,13 @@ def parameter_type_name(step_match_argument)
step_match_argument.parameter_type&.name if step_match_argument.respond_to?(:parameter_type)
end

def on_test_run_started(*)
def on_test_run_started(event)
@current_test_run_started_id = test_case_started_id(event.test_case)

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: event.test_cases.first.id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The id on a TestRunStarted should be a generated id that represents the entire test run - it doesn't pertain to any particular test case or attempt. The same value should then go on TestRunFinished.testRunStartedId at the end.

)
)

Expand Down Expand Up @@ -266,6 +271,10 @@ def on_undefined_parameter_type(event)
def test_case_started_id(test_case)
@test_case_started_by_test_case.test_case_started_id_by_test_case(test_case)
end

def test_run_started_id(test_case)
@test_run_started.test_run_id(test_case)
end
end
end
end
28 changes: 28 additions & 0 deletions lib/cucumber/formatter/query/test_run_started.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

require 'cucumber/formatter/errors'

module Cucumber
module Formatter
module Query
class TestRunStarted
def initialize(config)
@test_run_ids = {}
config.on_event :test_run_started, &method(:on_test_run_started)
end

def test_run_id(test_case)
return @test_run_ids[test_case.id] if @test_run_ids.key?(test_case.id)

raise TestCaseUnknownError, "No pickle found for #{test_case.id} }. Known: #{@test_run_ids.keys}"
end

private

def on_test_run_started(event)
@test_run_ids[event.test_case.id] = event.pickle.id
end
end
end
end
end
4 changes: 2 additions & 2 deletions spec/cucumber/deprecate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ module Cucumber
it 'outputs a message to $stderr' do
allow($stderr).to receive(:puts)

Cucumber.deprecate('Use some_method instead', 'someMethod', '1.0.0')
Cucumber.deprecate('Use #some_other_method instead', '#some_method', '1.0.0')
expect($stderr).to have_received(:puts).with(
a_string_including(
'WARNING: #someMethod is deprecated and will be removed after version 1.0.0. Use some_method instead.'
'WARNING: #some_method is deprecated and will be removed after version 1.0.0. Use #some_other_method instead.'
)
)
end
Expand Down
44 changes: 29 additions & 15 deletions spec/cucumber/formatter/interceptor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
end

context 'when passed :stderr' do
before :each do
@stderr = $stderr
end

after :each do
$stderr = @stderr
end
before { @stderr = $stderr }
after { $stderr = @stderr }

it 'wraps $stderr' do
wrapped = described_class.wrap(:stderr)
Expand All @@ -29,13 +24,8 @@
end

context 'when passed :stdout' do
before :each do
@stdout = $stdout
end

after :each do
$stdout = @stdout
end
before { @stdout = $stdout }
after { $stdout = @stdout }

it 'wraps $stdout' do
wrapped = described_class.wrap(:stdout)
Expand Down Expand Up @@ -82,11 +72,35 @@

it 'disables the pipe bypass' do
buffer = '(::)'
described_class.unwrap! :stdout
described_class.unwrap!(:stdout)
@wrapped.write(buffer)

expect(@wrapped.buffer_string).not_to end_with(buffer)
end

it 'wraps $stderr' do
wrapped = described_class.wrap(:stderr)

expect($stderr).to be_instance_of described_class
expect($stderr).to be wrapped
end

context 'when passed :stdout' do
before :each do
@stdout = $stdout
end

after :each do
$stdout = @stdout
end

it 'wraps $stdout' do
wrapped = described_class.wrap(:stdout)

expect($stdout).to be_instance_of described_class
expect($stdout).to be wrapped
end
end
end

describe '#write' do
Expand Down
Loading