diff --git a/.gitignore b/.gitignore index e4ba113ee..dc1222bf7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .bundle -nbproject coverage pkg doc @@ -8,20 +7,12 @@ tmp *.log *.pid .eprj -.tmtags -*~ .DS_Store -*.swp -*.swo target -*.tmproj -.#* .idea .vscode -*.pyc *.rbc rerun.txt -._* .rvmrc .sass-cache doc/ @@ -33,5 +24,4 @@ Gemfile.local Gemfile.local.lock .envrc Gemfile.lock -bin/json-formatter -acceptance/* \ No newline at end of file +acceptance/* diff --git a/Makefile b/Makefile deleted file mode 100644 index 9e9802058..000000000 --- a/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -MONOREPO_PATH ?= ../../cucumber - -# https://stackoverflow.com/questions/2483182/recursive-wildcards-in-gnu-make -rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) -RUBY_FILES=$(call rwildcard,../lib ../../cucumber-ruby-core/lib/,*.rb) - -FEATURES = $(sort $(wildcard features/docs/**.feature)) -GOLDEN_JSONS = $(patsubst features/docs/%.feature,acceptance/%-golden.json,$(FEATURES)) -GENERATED_JSONS = $(patsubst features/docs/%.feature,acceptance/%-generated.json,$(FEATURES)) -TESTED = $(patsubst features/docs/%.feature,acceptance/%.tested,$(FEATURES)) - -OS := $(shell [[ "$$(uname)" == "Darwin" ]] && echo "darwin" || echo "linux") -# Determine if we're on 386 or amd64 (ignoring other processors as we're not building on them) -ARCH := $(shell [[ "$$(uname -m)" == "x86_64" ]] && echo "amd64" || echo "386") - -default: $(GOLDEN_JSONS) $(GENERATED_JSONS) $(TESTED) -.PHONY: default - -acceptance/%.tested: acceptance/%-golden.json acceptance/%-generated.json - mkdir -p $$(dirname $@) - diff --unified $^ -.PHONY: acceptance/%.tested - -acceptance/%-golden.json: features/docs/%.feature $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json $(RUBY_FILES) - mkdir -p $$(dirname $@) - bundle exec cucumber --format=json $< | \ - jq --sort-keys "." | \ - $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json > $@ - -acceptance/%-generated.json: features/docs/%.feature $(RUBY_FILES) bin/json-formatter $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json - mkdir -p $$(dirname $@) - bundle exec cucumber --format=message $< | \ - bin/json-formatter --format ndjson | \ - jq --sort-keys "." | \ - $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json > $@ - -bin/json-formatter: $(MONOREPO_PATH)/json-formatter/go/dist/cucumber-json-formatter-$(OS)-$(ARCH) - cp $(MONOREPO_PATH)/json-formatter/go/dist/cucumber-json-formatter-$(OS)-$(ARCH) $@ - chmod +x $@ - -clean: - rm -rf acceptance/*.json bin/json-formatter -.PHONY: clean diff --git a/README.md b/README.md index 3e228e2fa..1c9af1e57 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,12 @@ Later in this document, bundler is considered being used so all commands are usi ### Supported platforms +- Ruby 4.0 - Ruby 3.4 - Ruby 3.3 - Ruby 3.2 -- Ruby 3.1 - TruffleRuby 24.0.0+ -- JRuby 9.4+ (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md)) +- JRuby 10.0+ (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md)) ### Ruby on Rails diff --git a/cucumber.gemspec b/cucumber.gemspec index fdd7fd492..ec51dfe17 100644 --- a/cucumber.gemspec +++ b/cucumber.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |s| s.add_dependency 'cucumber-ci-environment', '> 9', '< 12' s.add_dependency 'cucumber-core', '>= 16.2.0', '< 17' s.add_dependency 'cucumber-cucumber-expressions', '> 17', '< 20' - s.add_dependency 'cucumber-html-formatter', '> 21', '< 23' + s.add_dependency 'cucumber-html-formatter', '> 21', '< 24' s.add_dependency 'diff-lcs', '~> 1.5' s.add_dependency 'logger', '~> 1.6' s.add_dependency 'mini_mime', '~> 1.1' diff --git a/features/docs/cli/ordering.feature b/features/docs/cli/ordering.feature index 1c49a98cb..45b7b21aa 100644 --- a/features/docs/cli/ordering.feature +++ b/features/docs/cli/ordering.feature @@ -128,12 +128,6 @@ Feature: Ordering Randomized with seed 41544 """ - @force_legacy_loader - Scenario: Rerun scenarios randomized - When I run `cucumber --order random --format summary` - And I rerun the previous command with the same seed - Then the output of both commands should be the same - @global_state Scenario: Run scenarios randomized with some skipped When I run `cucumber --tags "not @skipme" --order random:41544 -q` diff --git a/features/lib/support/env.rb b/features/lib/support/env.rb index cf6307035..9a23f2686 100644 --- a/features/lib/support/env.rb +++ b/features/lib/support/env.rb @@ -35,13 +35,6 @@ ENV['CUCUMBER_PUBLISH_TOKEN'] = original_publish_token end -Around('@force_legacy_loader') do |_, block| - original_loader = Cucumber.use_legacy_autoloader - Cucumber.use_legacy_autoloader = true - block.call - Cucumber.use_legacy_autoloader = original_loader -end - Before('@global_state') do # Ok, this one is tricky but kinda make sense. # So, we need to share state between some sub-scenarios (the ones executed by diff --git a/lib/cucumber.rb b/lib/cucumber.rb index bc96e9283..a5ff1aefc 100644 --- a/lib/cucumber.rb +++ b/lib/cucumber.rb @@ -11,7 +11,6 @@ module Cucumber class << self attr_accessor :wants_to_quit - attr_reader :use_legacy_autoloader def deprecate(message, method, remove_after_version) Kernel.warn( @@ -24,22 +23,11 @@ def deprecate(message, method, remove_after_version) def logger return @log if @log - @log = Logger.new($stdout) - @log.level = Logger::INFO - @log + @log = Logger.new($stdout).tap { it.level = Logger::INFO } end def logger=(logger) @log = logger end - - def use_legacy_autoloader=(value) - Cucumber.deprecate( - 'This will be phased out of cucumber and should not be used. It is only there to support legacy systems', - '.use_legacy_autoloader', - '11.0.0' - ) - @use_legacy_autoloader = value - end end end diff --git a/lib/cucumber/formatter/usage.rb b/lib/cucumber/formatter/usage.rb index 846b46562..6852e0791 100644 --- a/lib/cucumber/formatter/usage.rb +++ b/lib/cucumber/formatter/usage.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true require 'cucumber/formatter/progress' -require 'cucumber/step_definition_light' require 'cucumber/formatter/console' module Cucumber module Formatter class Usage < Progress include Console + class StepDefKey attr_accessor :mean_duration, :status attr_reader :regexp_source, :location diff --git a/lib/cucumber/glue/registry_and_more.rb b/lib/cucumber/glue/registry_and_more.rb index 1939ffec6..be693b010 100644 --- a/lib/cucumber/glue/registry_and_more.rb +++ b/lib/cucumber/glue/registry_and_more.rb @@ -13,7 +13,6 @@ require 'cucumber/gherkin/i18n' require 'multi_test' require 'cucumber/step_match' -require 'cucumber/step_definition_light' require 'cucumber/events/step_definition_registered' module Cucumber @@ -128,12 +127,7 @@ def load_code_file(code_file) return unless File.extname(code_file) == '.rb' # This will cause self.add_step_definition, self.add_hook, and self.define_parameter_type to be called from Glue::Dsl - - if Cucumber.use_legacy_autoloader - load File.expand_path(code_file) - else - require File.expand_path(code_file) - end + require File.expand_path(code_file) end def begin_scenario(test_case) diff --git a/lib/cucumber/multiline_argument/data_table.rb b/lib/cucumber/multiline_argument/data_table.rb index b554434c5..c01a1624c 100644 --- a/lib/cucumber/multiline_argument/data_table.rb +++ b/lib/cucumber/multiline_argument/data_table.rb @@ -364,17 +364,6 @@ def verify_table_width(width) raise %(The table must have exactly #{width} columns) unless raw[0].size == width end - # TODO: remove the below function if it's not actually being used. - # Nothing else in this repo calls it. - def text?(text) - Cucumber.deprecate( - 'This method is no longer supported for checking text', - '#text?', - '11.0.0' - ) - raw.flatten.compact.detect { |cell_value| cell_value.index(text) } - end - def cells_rows @rows ||= cell_matrix.map do |cell_row| Cells.new(self, cell_row) diff --git a/lib/cucumber/step_definition_light.rb b/lib/cucumber/step_definition_light.rb deleted file mode 100644 index 9a0a13c54..000000000 --- a/lib/cucumber/step_definition_light.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module Cucumber - # TODO: pointless, ancient, kill with fire. - # Only used for keeping track of available and invoked step definitions - # in a way that also works for other programming languages (i.e. cuke4duke) - # Used for reporting purposes only (usage formatter). - class StepDefinitionLight - attr_reader :regexp_source, :location - - def initialize(regexp_source, location) - @regexp_source = regexp_source - @location = location - Cucumber.deprecate( - 'StepDefinitionLight class is no longer a supported part of cucumber', - '#initialize', - '11.0.0' - ) - end - - def eql?(other) - regexp_source == other.regexp_source && location == other.location - end - - def hash - regexp_source.hash + 31 * location.to_s.hash - end - end -end diff --git a/spec/cucumber/glue/registry_and_more_spec.rb b/spec/cucumber/glue/registry_and_more_spec.rb index a7e6c60e3..47a163c82 100644 --- a/spec/cucumber/glue/registry_and_more_spec.rb +++ b/spec/cucumber/glue/registry_and_more_spec.rb @@ -39,7 +39,6 @@ def self.value; 2; end end STRING end - let(:value3) do <<~STRING class Foo @@ -73,51 +72,6 @@ def a_file_called(name) expect(Foo.value).not_to eq(3) end end - - context 'when using `use_legacy_autoloader`' do - before(:each) { allow(Cucumber).to receive(:use_legacy_autoloader).and_return(true) } - - it 're-loads the file when called multiple times' do - a_file_called('tmp2.rb') { value1 } - registry.load_code_file('tmp2.rb') - a_file_called('tmp2.rb') { value2 } - registry.load_code_file('tmp2.rb') - - expect(Foo.value).to eq(2) - end - - it 'only loads ruby files' do - a_file_called('tmp2.rb') { value1 } - a_file_called('docs2.md') { value3 } - registry.load_code_file('tmp2.rb') - registry.load_code_file('docs2.md') - - expect(Foo.value).not_to eq(3) - end - end - - context 'when explicitly NOT using `use_legacy_autoloader`' do - before(:each) { allow(Cucumber).to receive(:use_legacy_autoloader).and_return(false) } - after(:each) { FileUtils.rm_rf('tmp3.rb') } - - it 'does not re-load the file when called multiple times' do - a_file_called('tmp3.rb') { value1 } - registry.load_code_file('tmp3.rb') - a_file_called('tmp3.rb') { value2 } - registry.load_code_file('tmp3.rb') - - expect(Foo.value).to eq(1) - end - - it 'only loads ruby files' do - a_file_called('tmp3.rb') { value1 } - a_file_called('docs3.md') { value3 } - registry.load_code_file('tmp3.rb') - registry.load_code_file('docs3.md') - - expect(Foo.value).not_to eq(3) - end - end end describe 'Handling the World' do diff --git a/upgrading_notes/11.0.0.md b/upgrading_notes/11.0.0.md new file mode 100644 index 000000000..211f563b4 --- /dev/null +++ b/upgrading_notes/11.0.0.md @@ -0,0 +1,37 @@ +# Upgrading to 11.0.0 + +## CCK conformance + +CCK conformance has been bumped to v22. This has seen a lot of rewrites specifically around formatters +- The `message` default formatters (Which all other formatters are being built on, has been refactored heavily to output more information +- The `rerun` formatter is now completely rebuilt using messages - the behaviour should be identical + +## Removed previously deprecated items that were deprecated in v10 + +### #text? + +The `#text?` method for checking differences in multi-line heredocs or texts has been removed + +Should you wish to check multi-line text fragments for differences and issues, there are a host of better-suited +libraries that handle this better, and this should be handled outside the remit of cucumber + +### Cucumber.use_legacy_autoloader configuration setting + +This setting has now been removed. All files will only ever autoload once + +### StepDefinitionLight + +This class and its associated actions has been removed. It served little to no purpose other than in +one of the legacy formatters that we aim to remove and port to messages and some associated "shim" languages +which aren't in the purview of the team anymore + +## Newly deprecated items + +### Strict configuration + +For a while cucumber has been heavily divergent in terms of how it handles "strict" mode - In some places it was a configuration setting, +in others it was a command line flag, and in others it was just a concept that was handled differently across different formatters + +Going forward in v11, we will explicitly advise against using strict mode and instead encourage users to use the intended +default behaviours for scenarios that involve undefined steps, pending steps, or failed steps. This is in line with the intended design of cucumber and will help to +encourage better practices and more consistent behaviour across different formatters and runners