Skip to content

Conversation

aurelien-reeves
Copy link
Contributor

Description

bundle exec rspec

Is resulting into a failing tests only with jruby 9.3: spec/cucumber/glue/step_definition_spec.rb:92

When executing only that test, or spec file, or even all the spec in spec/cucumber/glue, the test is properly passing.

I am running rspec --bisect at the moment. Still waiting for it to finish.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Please add an entry to the relevant section of CHANGELOG.md as part of this pull request.

Checklist:

Your PR is ready for review once the following checklist is
complete. You can also add some checks if you want to.

  • Tests have been added for any changes to behaviour of the code
  • New and existing tests are passing locally and on CI
  • bundle exec rubocop reports no offenses
  • RDoc comments have been updated
  • CHANGELOG.md has been updated

@aurelien-reeves
Copy link
Contributor Author

bisect has found the following minimal reproduction command:

bundle exec rspec './spec/cucumber/formatter/junit_spec.rb[1:4:3:5:1,1:4:3:5:2,1:4:3:6:1:1,1:4:3:6:2:1,1:4:3:6:3:1,1:4:3:6:4:1,1:5:1:1:1,1:5:1:1:2,1:5:1:1:3,1:5:1:1:4,1:5:1:1:5,1:5:1:1:6,1:5:1:1:7]' './spec/cucumber/formatter/pretty_spec.rb[1:1:1:9:1,1:1:1:10:1,1:5:3:1,1:5:4:1]' './spec/cucumber/formatter/progress_spec.rb[1:1:4:1:1,1:1:4:2:1,1:1:4:3:1]' './spec/cucumber/formatter/query/step_definitions_by_test_step_spec.rb[1:1:1:1:1,1:1:1:2:2:1,1:1:2:1:1,1:1:2:2:1]' './spec/cucumber/glue/proto_world_spec.rb[1:2:1:1,1:2:2:1,1:2:3:1,1:2:4:1,1:3:1:1,1:3:1:2]' './spec/cucumber/glue/step_definition_spec.rb[1:1,1:2,1:3:1,1:3:2,1:3:3,1:3:4,1:4,1:5,1:6,1:7,1:8,1:9,1:10,1:13,1:14]'

@aurelien-reeves
Copy link
Contributor Author

jRuby 9.3 seems to add, sometimes, an extra caller location in that specific scenario.

If patching step_definition.rb:44 with the following:

      def patch_location_onto(block)
          puts Core::Test::Location.of_caller(0)
          puts Core::Test::Location.of_caller(1)
          puts Core::Test::Location.of_caller(2)
          puts Core::Test::Location.of_caller(3)
          puts Core::Test::Location.of_caller(4)
          puts Core::Test::Location.of_caller(5)
          puts Core::Test::Location.of_caller(6)
          puts Core::Test::Location.of_caller(7)
          location = Core::Test::Location.of_caller(5)
          block.define_singleton_method(:source_location) { [location.file, location.line] }
          block
        end

With anything else than jruby 9.3 with the specific execution order, the output is the following

lib/cucumber/glue/step_definition.rb:38
lib/cucumber/glue/step_definition.rb:28
lib/cucumber/glue/registry_and_more.rb:88
lib/cucumber/glue/dsl.rb:31
lib/cucumber/glue/dsl.rb:152
spec/cucumber/glue/step_definition_spec.rb:93
rspec-core-3.10.1/lib/rspec/core/example.rb:262
rspec-core-3.10.1/lib/rspec/core/example.rb:262

But with the specified test suite, with jruby 9.3, the result is the following:

lib/cucumber/glue/step_definition.rb:38
lib/cucumber/glue/step_definition.rb:28
lib/cucumber/glue/step_definition.rb:26
lib/cucumber/glue/registry_and_more.rb:88
lib/cucumber/glue/dsl.rb:31
lib/cucumber/glue/dsl.rb:152
spec/cucumber/glue/step_definition_spec.rb:93
rspec-core-3.10.1/lib/rspec/core/example.rb:262

As soon as we change the minimal reproduction rspec command with jruby 9.3, or we use anything else than jruby 9.3, the caller lib/cucumber/glue/step_definition.rb:26 is not in the list.

@aurelien-reeves
Copy link
Contributor Author

From jruby/jruby#6858 (comment)

The issue will be fixed with jruby 9.3.1.
That mean that we will have to inform that jruby 9.3.0 is not compatible due to a known issue fixed with jruby 9.3.1 once it is released.

Copy link
Contributor

@aslakhellesoy aslakhellesoy left a comment

Choose a reason for hiding this comment

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

LGTM

@aurelien-reeves aurelien-reeves merged commit 8e4d4e0 into main Nov 4, 2021
@luke-hill luke-hill deleted the fix-jruby-9.3 branch August 22, 2023 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants