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 6 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
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 @@ -69,7 +69,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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ Later in this document, bundler is considered being used so all commands are usi

### Supported platforms

- 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
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
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
49 changes: 18 additions & 31 deletions spec/cucumber/formatter/interceptor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ module Formatter
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 @@ -31,13 +26,8 @@ module Formatter
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 All @@ -54,10 +44,7 @@ module Formatter
$stdout = pipe
@wrapped = described_class.wrap(:stdout)
end

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

it "raises an ArgumentError if it wasn't passed :stderr/:stdout" do
expect { described_class.unwrap!(:nonsense) }.to raise_error(ArgumentError)
Expand All @@ -72,18 +59,17 @@ module Formatter

it 'noops if $stdout or $stderr has been overwritten' do
$stdout = StringIO.new
pipe = described_class.unwrap! :stdout
pipe = described_class.unwrap!(:stdout)
expect(pipe).to eq $stdout

$stderr = StringIO.new
pipe = described_class.unwrap! :stderr
pipe = described_class.unwrap!(:stderr)
expect(pipe).to eq $stderr
end

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)
Expand All @@ -95,8 +81,8 @@ module Formatter
let(:pi) { described_class.new(pipe) }

it 'writes arguments to the original pipe' do
expect(pipe).to receive(:write).with(buffer) { buffer.size }
expect(pi.write(buffer)).to eq buffer.size
expect(pipe).to receive(:write).with(buffer) { buffer.length }
expect(pi.write(buffer)).to eq(buffer.length)
end

it 'adds the buffer to its stored output' do
Expand All @@ -105,20 +91,20 @@ module Formatter
pi.write(buffer)

expect(pi.buffer_string).not_to be_empty
expect(pi.buffer_string).to eq buffer
expect(pi.buffer_string).to eq(buffer)
end
end

describe '#method_missing' do
let(:pi) { described_class.new(pipe) }

it 'passes #tty? to the original pipe' do
it 'passes `#tty?` to the original pipe' do
expect(pipe).to receive(:tty?).and_return(true)
expect(pi.tty?).to be true
end
end

describe '#respond_to' do
describe '#respond_to?' do
let(:pi) { described_class.wrap(:stderr) }

it 'responds to all methods $stderr has' do
Expand All @@ -129,14 +115,15 @@ module Formatter
describe 'when calling `methods` on the stream' do
it 'does not raise errors' do
allow($stderr).to receive(:puts)

described_class.wrap(:stderr)
expect { $stderr.puts('Oh, hi here !') }.not_to raise_exception(NoMethodError)

expect { $stderr.puts('Oh, hi here !') }.not_to raise_error
end

it 'does not shadow errors when method do not exist on the stream' do
it 'does not shadow errors when the method does not exist on the stream' do
described_class.wrap(:stderr)
expect { $stderr.not_really_puts('Oh, hi here !') }.to raise_exception(NoMethodError)

expect { $stderr.not_really_puts('Oh, hi here !') }.to raise_error(NoMethodError)
end
end
end
Expand Down
Loading