Giter VIP home page Giter VIP logo

Comments (11)

irphilli avatar irphilli commented on September 25, 2024 1

I will try queue mode! I was going to follow up with some additional info, but you got to the same conclusion :).

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 25, 2024 1

I think it is a bug in our code. The extra --format progress option is added when formatters are empty but we don't check if someone passed --format option, or --options .rspec_custom_file that has --format inside of the file.

It was introduced here for Regular Mode.

I notice also issue for Queue Mode.

I reported this in the internal ticket.

@irphilli Please use inline options. Thanks to that, the --format option is applied.

Example:

# Queue Mode (--format documentation is applied inline)
bundle exec rake "knapsack_pro:queue:rspec[--options .rspec_custom.options --format RspecJunitFormatter --out tmp/rspec.xml --format documentation]"

# Regular Mode (--format documentation is applied inline)
bundle exec rake "knapsack_pro:rspec[--options .rspec_custom.options --format RspecJunitFormatter --out tmp/rspec.xml --format documentation]"

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 25, 2024

Hi @irphilli

I can't reproduce the issue. I tested this locally and it seems to work for Queue Mode and Regular Mode.

Can you share the Knapsack Pro command that you use to run tests?

Do you use this configuration here? https://docs.knapsackpro.com/ruby/rspec/#formatters-rspec_junit_formatter-json

from knapsack_pro-ruby.

irphilli avatar irphilli commented on September 25, 2024

Thanks for looking into it! I'm using something similar with a file for the options with: knapsack_pro:rspec[--options ./.rspec]

I also have some custom reporters that might be part of the issue, but the non-custom part of the config is:

-r rspec_junit_formatter
--format RspecJunitFormatter
--out tmp/rspec/junit.xml
--format documentation

I'll take a look at some of the custom reporters I have if it can't be reproduced.

from knapsack_pro-ruby.

irphilli avatar irphilli commented on September 25, 2024

Looking further into the test output, it looks like --format documentation isn't working as expected either! So, it seems like maybe something is off with using --options.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 25, 2024

What is your RSpec version?

I created a script to run Knapsack Pro with the RSpec --options provided, and the JUnit XML file is generated correctly.
KnapsackPro/rails-app-with-knapsack_pro@675a118

I'm not sure how to reproduce the issue.
Can you share more details about your config? What's the content of rails_helper.rb/spec_helper.rb. What are your custom formatters. The full list of options that are provided to the Knapsack Pro command.

If that's private data, you can share it with the support email https://knapsackpro.com/contact

You can also look at recent changes we did in 6.x version of the knapsack_pro gem. We added a custom RSpec formatter to track tests execution time. Maybe this is causing some conflict with your formatters.

from knapsack_pro-ruby.

irphilli avatar irphilli commented on September 25, 2024

Here are my versions:

RSpec 3.12
  - rspec-core 3.12.2
  - rspec-expectations 3.12.3
  - rspec-mocks 3.12.6
  - rspec-rails 6.1.0
  - rspec-support 3.12.1

Seems like maybe just something up with my particular setup specifically (will dig into that more). I've trimmed down the options file to:

--format documentation

And, the output is not coming out in the "documentation" format, when run like: knapsack_pro:rspec[--options ./.rspec]. However, when run like knapsack_pro:rspec[--format documentation], it outputs as expected.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 25, 2024

If the --format documentation is present in the ./.rspec file then the output should be in the documentation format. Is --format documentation inside of the ./.rspec file?

This is how I use options: https://github.com/KnapsackPro/rails-app-with-knapsack_pro/blob/1f217df18c71db7dae01f28f89a0e394b33a2a61/bin/knapsack_pro_queue_rspec_junit_with_rspec_custom_options#L18

Maybe you should use .rspec instead of ./.rspec. Why do you add ./?

Please try bundle exec rake "knapsack_pro:rspec[--options .rspec]". Please remember to add "to wrap the options passed to the knapsack_pro command. Otherwise the options won't work.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 25, 2024

@irphilli I got an email notification that you were asking about:

Looking at the command generated by the runner:

/usr/local/bin/ruby -I/app/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib:/app/vendor/bundle/ruby/3.2.0/gems/rspec-support-3.12.1/lib /app/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/exe/rspec --format documentation --options .rspec --format progress --format KnapsackPro::Formatters::TimeTracker --default-path spec ...

It looks like an extra --format progress is getting inserted (overrides --format documentation). This doesn't yet explain my original issue, but seems like there is something different in the generated command with 6.0+ when it comes to the format options.

If a formatter is not detected in Regular Mode then --format progress is added as a default formatter. It seems that --options .rspec is not loaded as the RSpec configuration option, and the --format documentation could not be detected. It's something that we could improve here:
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/229/files#diff-23b86e488780bfc91dda40439ac5e4f6be1c67e0739bad6c286d36bae402adf3R54

Do you see a similar issue for Queue Mode: bundle exec rake "knapsack_pro:queue:rspec"?

from knapsack_pro-ruby.

irphilli avatar irphilli commented on September 25, 2024

So, I do see the same issue in queue mode, but looks like it was already like that in 5.x.

Going back to standard mode, I went ahead and got rid of our options file (passed in arguments directly), and things are working fine, even with the custom reporters. The only strange thing is that the generated rspec command still has an extra --format progress in there.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 25, 2024

I'm closing this in favor of using inline options as in the above example.

from knapsack_pro-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.