Skip to content
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

rspec testsuite error with ruby3.4.0dev #1770

Open
mtasaka opened this issue Nov 28, 2024 · 1 comment · May be fixed by #1771
Open

rspec testsuite error with ruby3.4.0dev #1770

mtasaka opened this issue Nov 28, 2024 · 1 comment · May be fixed by #1771

Comments

@mtasaka
Copy link

mtasaka commented Nov 28, 2024

Testing with ruby 3.4.0dev (2024-11-28 master c0e607cef1) +PRISM [x86_64-linux]
ruby/ruby@c0e607c

with cucumber git head
ab98919
rspec testsuite fails like

$ bundle exec rake
/usr/bin/ruby -I/usr/share/gems/gems/rspec-core-3.13.2/lib:/usr/share/gems/gems/rspec-support-3.13.1/lib /usr/share/gems/gems/rspec-core-3.13.2/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --tag ~cck
Run options: exclude {cck: true}
........................................................................................................................................*****...........................................................................................................................FF.........F...............................................................................................................................FF............................................................................................................................WARNING: consider using an array rather than a space-delimited string with cucumber_opts to avoid undesired behavior.
.WARNING: consider using an array rather than a space-delimited string with cucumber_opts to avoid undesired behavior.
........................................................................

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Cucumber::Cli::ProfileLoader when on a Windows OS treats backslashes as literals in rerun.txt when on Windows (JRuby or MRI)
     # These tests are only to be ran on Windows
     # ./spec/cucumber/cli/profile_loader_spec.rb:21

  2) Cucumber::Cli::ProfileLoader when on a Windows OS treats forward slashes as literals
     # These tests are only to be ran on Windows
     # ./spec/cucumber/cli/profile_loader_spec.rb:27

  3) Cucumber::Cli::ProfileLoader when on a Windows OS treats percent sign as ERB code block after YAML directive
     # These tests are only to be ran on Windows
     # ./spec/cucumber/cli/profile_loader_spec.rb:33

  4) Cucumber::Cli::ProfileLoader when on a Windows OS correctly parses a profile that uses tag expressions (with double quotes)
     # These tests are only to be ran on Windows
     # ./spec/cucumber/cli/profile_loader_spec.rb:43

  5) Cucumber::Cli::ProfileLoader when on a Windows OS correctly parses a profile that uses tag expressions (with single quotes)
     # These tests are only to be ran on Windows
     # ./spec/cucumber/cli/profile_loader_spec.rb:49


Failures:

  1) Cucumber::Formatter::Json with a scenario with a failed step outputs the json data
     Failure/Error:
       expect(load_normalised_json(@out)).to eq JSON.parse(%{
           [{"id": "banana-party",
             "uri": "spec.feature",
             "keyword": "Feature",
             "name": "Banana party",
             "line": 1,
             "description": "",
             "elements":
              [{"id": "banana-party;monkey-eats-bananas",
                "keyword": "Scenario",
     
       expected: [{"description" => "", "elements" => [{"description" => "", "id" => "banana-party;monkey-eats-bananas...ana-party", "keyword" => "Feature", "line" => 1, "name" => "Banana party", "uri" => "spec.feature"}]
            got: [{"description" => "", "elements" => [{"description" => "", "id" => "banana-party;monkey-eats-bananas...ana-party", "keyword" => "Feature", "line" => 1, "name" => "Banana party", "uri" => "spec.feature"}]
     
       (compared using ==)
     
       Diff:
       @@ -13,7 +13,7 @@
                "result" =>
                 {"duration" => 1,
                  "error_message" =>
       -           "no bananas (RuntimeError)\n./spec/cucumber/formatter/json_spec.rb:99:in `/^there are bananas$/'\nspec.feature:4:in `there are bananas'",
       +           "no bananas (RuntimeError)\n./spec/cucumber/formatter/json_spec.rb:99:in 'block (4 levels) in <module:Formatter>'\n./spec/cucumber/formatter/spec_helper.rb:29:in 'Cucumber::Formatter::SpecHelper#run_defined_feature'\n./spec/cucumber/formatter/json_spec.rb:18:in 'block (2 levels) in <module:Formatter>'\nspec.feature:4:in `there are bananas'",
                  "status" => "failed"}}],
             "type" => "scenario"}],
          "id" => "banana-party",
       
     # ./spec/cucumber/formatter/json_spec.rb:103:in 'block (3 levels) in <module:Formatter>'

  2) Cucumber::Formatter::Json with a scenario with a pending step outputs the json data
     Failure/Error:
       expect(load_normalised_json(@out)).to eq JSON.parse(%{
           [{"id": "banana-party",
             "uri": "spec.feature",
             "keyword": "Feature",
             "name": "Banana party",
             "line": 1,
             "description": "",
             "elements":
              [{"id": "banana-party;monkey-eats-bananas",
                "keyword": "Scenario",
     
       expected: [{"description" => "", "elements" => [{"description" => "", "id" => "banana-party;monkey-eats-bananas...ana-party", "keyword" => "Feature", "line" => 1, "name" => "Banana party", "uri" => "spec.feature"}]
            got: [{"description" => "", "elements" => [{"description" => "", "id" => "banana-party;monkey-eats-bananas...ana-party", "keyword" => "Feature", "line" => 1, "name" => "Banana party", "uri" => "spec.feature"}]
     
       (compared using ==)
     
       Diff:
       @@ -13,7 +13,7 @@
                "result" =>
                 {"duration" => 1,
                  "error_message" =>
       -           "TODO (Cucumber::Pending)\n./spec/cucumber/formatter/json_spec.rb:137:in `/^there are bananas$/'\nspec.feature:4:in `there are bananas'",
       +           "TODO (Cucumber::Pending)\n./spec/cucumber/formatter/json_spec.rb:137:in 'block (4 levels) in <module:Formatter>'\n./spec/cucumber/formatter/spec_helper.rb:29:in 'Cucumber::Formatter::SpecHelper#run_defined_feature'\n./spec/cucumber/formatter/json_spec.rb:18:in 'block (2 levels) in <module:Formatter>'\nspec.feature:4:in `there are bananas'",
                  "status" => "pending"}}],
             "type" => "scenario"}],
          "id" => "banana-party",
       
     # ./spec/cucumber/formatter/json_spec.rb:141:in 'block (3 levels) in <module:Formatter>'

  3) Cucumber::Formatter::Json with a scenario when only an around hook is failing includes the around hook result in the json data
     Failure/Error:
       expect(load_normalised_json(@out)).to eq JSON.parse(%{
           [{"id": "banana-party",
             "uri": "spec.feature",
             "keyword": "Feature",
             "name": "Banana party",
             "line": 1,
             "description": "",
             "elements":
              [{"id": "banana-party;monkey-eats-bananas",
                "keyword": "Scenario",
     
       expected: [{"description" => "", "elements" => [{"around" => [{"match" => {"location" => "unknown_hook_location...ana-party", "keyword" => "Feature", "line" => 1, "name" => "Banana party", "uri" => "spec.feature"}]
            got: [{"description" => "", "elements" => [{"around" => [{"match" => {"location" => "unknown_hook_location...ana-party", "keyword" => "Feature", "line" => 1, "name" => "Banana party", "uri" => "spec.feature"}]
     
       (compared using ==)
     
       Diff:
       @@ -5,7 +5,7 @@
                "result" =>
                 {"duration" => 1,
                  "error_message" =>
       -           "error (RuntimeError)\n./spec/cucumber/formatter/json_spec.rb:684:in `Around'",
       +           "error (RuntimeError)\n./spec/cucumber/formatter/json_spec.rb:684:in 'block (4 levels) in <module:Formatter>'\n./spec/cucumber/formatter/spec_helper.rb:29:in 'Cucumber::Formatter::SpecHelper#run_defined_feature'\n./spec/cucumber/formatter/json_spec.rb:18:in 'block (2 levels) in <module:Formatter>'",
                  "status" => "failed"}}],
             "description" => "",
             "id" => "banana-party;monkey-eats-bananas",
       
     # ./spec/cucumber/formatter/json_spec.rb:690:in 'block (3 levels) in <module:Formatter>'

  4) Cucumber::Glue::ProtoWorld Handling logs in step definitions when logging an object attached the styring version on the object
     Failure/Error: expect(@out.string).to include '{:a=>1, :b=>2, :c=>3}'
     
       expected "Feature: Banana party\n\n  Scenario: Monkey eats banana\n    When an object is logged\n      {a: 1, b: 2, c: 3}\n\n1 scenario (1 passed)\n1 step (1 passed)\n0m0.000s\n" to include "{:a => 1, :b => 2, :c => 3}"
       Diff:
       @@ -1,9 +1,17 @@
       -{:a=>1, :b=>2, :c=>3}
       +Feature: Banana party
       +
       +  Scenario: Monkey eats banana
       +    When an object is logged
       +      {a: 1, b: 2, c: 3}
       +
       +1 scenario (1 passed)
       +1 step (1 passed)
       +0m0.000s
       
     # ./spec/cucumber/glue/proto_world_spec.rb:76:in 'block (4 levels) in <module:Glue>'

  5) Cucumber::Glue::ProtoWorld Handling logs in step definitions when logging multiple items on one call logs each parameter independently
     Failure/Error:
       expect(@out.string).to include [
         '      subject: monkey',
         '      verb: eats',
         '      complement: banana',
         '      {:subject=>"monkey", :verb=>"eats", :complement=>"banana"}'
       ].join("\n")
     
       expected "Feature: Banana party\n\n  Scenario: Monkey eats banana\n    When monkey eats banana\n      subject:...\", verb: \"eats\", complement: \"banana\"}\n\n1 scenario (1 passed)\n1 step (1 passed)\n0m0.000s\n" to include "      subject: monkey\n      verb: eats\n      complement: banana\n      {:subject => \"monkey\", :verb => \"eats\", :complement => \"banana\"}"
       Diff:
       @@ -1,12 +1,23 @@
       -      subject: monkey\n      verb: eats\n      complement: banana\n      {:subject=>"monkey", :verb=>"eats", :complement=>"banana"}
       +Feature: Banana party
       +
       +  Scenario: Monkey eats banana
       +    When monkey eats banana
       +      subject: monkey
       +      verb: eats
       +      complement: banana
       +      {subject: "monkey", verb: "eats", complement: "banana"}
       +
       +1 scenario (1 passed)
       +1 step (1 passed)
       +0m0.000s
       
     # ./spec/cucumber/glue/proto_world_spec.rb:95:in 'block (4 levels) in <module:Glue>'

Finished in 2.49 seconds (files took 0.54847 seconds to load)
602 examples, 5 failures, 5 pending

I guess this is mainly due to ruby3.4 Hash#inspect change or so:
https://github.com/ruby/ruby/blob/319ac31529eb7bf7e5a4ef582c6f930bd8fca62e/NEWS.md?plain=1#L208-L229

https://bugs.ruby-lang.org/issues/20433
https://bugs.ruby-lang.org/issues/16495

@luke-hill
Copy link
Contributor

Thanks for this. The current main branch for cucumber-ruby is known to be faulty. This is because I'm fixing up 2/3 other areas first and there's a lot of interop issues.

However this issue "doesn't seem" like it's one of the ones I know about (There's an issue with core helpers that is broken until I cut a release)

Looking at failure 5 it looks like rogue ' characters are appearing on the subject/verb/complement lines but then looking at failure 2/3 it looks like the Block "name" isn't being reported but the stacktrace is.

This looks like I'll need to do some serious digging into this. But it won't happen until I get some of the fixes / v10 work in first - sorry.

@orien orien linked a pull request Dec 27, 2024 that will close this issue
5 tasks
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 a pull request may close this issue.

2 participants