thekompanee / fuubar

The instafailing RSpec progress bar formatter
http://jeffkreeftmeijer.com/2010/fuubar-the-instafailing-rspec-progress-bar-formatter/
MIT License
955 stars 65 forks source link

Avoid deprecation warning from ProgressBar::Progress#increment #102

Closed K-S-A closed 5 years ago

K-S-A commented 6 years ago

Fix warning message from ProgressBar::Progress#increment

This PR fixes warning from https://github.com/jfelchner/ruby-progressbar/blob/7c347ce6840e4bda541007eeb65853377a3943cb/lib/ruby-progressbar/progress.rb#L39-L41

Screenshots

2018-08-02 00 26 21

Checklist:

jfelchner commented 6 years ago

@K-S-A this should literally never happen. Can you give me a repo for this error so that I can reproduce?

K-S-A commented 6 years ago

Original repo is private and I can't share a link.

I've spent some time debugging. Looks like the issue can be reproduced by including 'rspec-simplecov' gem with basic configuration:

if ENV['COVERAGE']
  require 'rspec/simplecov'

  RSpec::SimpleCov.start
end

I believe that one extra example from here caused additional increment call: https://github.com/replaygaming/rspec-simplecov/blob/master/lib/rspec/simplecov/setup.rb#L92

jfelchner commented 6 years ago

@K-S-A I'm not asking for the original repo. But if you can create an app/gem/whatever that is very basic and reproduces the problem, that'd be awesome.

K-S-A commented 6 years ago

@jfelchner, probably, my explanation is not complete. Sorry about that. I've tried to say, that problem appears only with rspec-simplecov gem. I've reached the particular code line, that causes noisy output. The provided code sample is enough to reproduce the issue.

Reproduction example: https://github.com/K-S-A/rspec-simplecov-test

> COVERAGE=true rspec -f Fuubar
No examples found.

Randomized with seed 43175
 0/0 |======================= 100 ========================>| Time: 00:00:00
WARNING: Your progress bar is currently at 0 out of 0 and cannot be incremented. In v2.0.0 this will become a ProgressBar::InvalidProgressError.
 0/0 |======================= 100 ========================>| Time: 00:00:00

Top 1 slowest examples (0.00252 seconds, 34.5% of total time):
  SimpleCov#minimum_coverage must be at least 0.0%
    0.00252 seconds

Finished in 0.00731 seconds (files took 0.18622 seconds to load)
1 example, 0 failures

Randomized with seed 43175
> rspec -f Fuubar
No examples found.

Randomized with seed 23991
 0/0 |======================= 100 ========================>| Time: 00:00:00

Top 0 slowest examples (0 seconds, 0.0% of total time):

Finished in 0.00271 seconds (files took 0.1558 seconds to load)
0 examples, 0 failures

Randomized with seed 23991
jfelchner commented 6 years ago

@K-S-A that's perfect! Thanks!!

jfelchner commented 5 years ago

@K-S-A finally got around to this. This is not the fix for this particular issue. The error is upstream in simplecov. It's calling example_passed even though no examples were run. You can see this in the backtrace (important lines have asterisks in front of them).

I'd suggest reaching out to them and make sure this doesn't get called if there are no examples.

Backtrace
"/usr/local/opt/ruby/gems/2.6.0/gems/ruby-progressbar/lib/ruby-progressbar/base.rb:178:in `block in update_progress'",
"/usr/local/opt/ruby/gems/2.6.0/gems/ruby-progressbar/lib/ruby-progressbar/output.rb:43:in `with_refresh'",
"/usr/local/opt/ruby/gems/2.6.0/gems/ruby-progressbar/lib/ruby-progressbar/base.rb:177:in `update_progress'",
"/usr/local/opt/ruby/gems/2.6.0/gems/ruby-progressbar/lib/ruby-progressbar/base.rb:93:in `increment'",
"/usr/local/opt/ruby/gems/2.6.0/gems/fuubar-2.3.1/lib/fuubar.rb:125:in `block in increment'",
"/usr/local/opt/ruby/gems/2.6.0/gems/fuubar-2.3.1/lib/fuubar.rb:134:in `with_current_color'",
"/usr/local/opt/ruby/gems/2.6.0/gems/fuubar-2.3.1/lib/fuubar.rb:125:in `increment'",
"/usr/local/opt/ruby/gems/2.6.0/gems/fuubar-2.3.1/lib/fuubar.rb:77:in `example_passed'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:206:in `block in notify'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:205:in `each'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:205:in `notify'",
*"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:136:in `example_passed'",*
*"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-simplecov-0.2.2/lib/rspec/simplecov/setup.rb:69:in `evaluate_and_report_result'",*
*"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-simplecov-0.2.2/lib/rspec/simplecov/setup.rb:86:in `setup_execute_and_analyse_coverage_example'",*
*"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-simplecov-0.2.2/lib/rspec/simplecov/setup.rb:93:in `block (2 levels) in do'",*
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/example.rb:447:in `instance_exec'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/example.rb:447:in `instance_exec'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/hooks.rb:357:in `run'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1981:in `block in run_suite_hooks'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1979:in `each'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1979:in `run_suite_hooks'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/configuration.rb:1928:in `with_suite_hooks'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:113:in `block in run_specs'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/reporter.rb:79:in `report'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:112:in `run_specs'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:87:in `run'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:71:in `run'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/lib/rspec/core/runner.rb:45:in `invoke'",
"/usr/local/opt/ruby/gems/2.6.0/gems/rspec-core-3.7.1/exe/rspec:4:in `'",
"/usr/local/opt/ruby/2.6.2/bin/rspec:23:in `load'",
"/usr/local/opt/ruby/2.6.2/bin/rspec:23:in `'",
"/usr/local/opt/ruby/2.6.0/bundler/cli/exec.rb:74:in `load'",
"/usr/local/opt/ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'",
"/usr/local/opt/ruby/2.6.0/bundler/cli/exec.rb:28:in `run'",
"/usr/local/opt/ruby/2.6.0/bundler/cli.rb:463:in `exec'",
"/usr/local/opt/ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'",
"/usr/local/opt/ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'",
"/usr/local/opt/ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'",
"/usr/local/opt/ruby/2.6.0/bundler/cli.rb:27:in `dispatch'",
"/usr/local/opt/ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'",
"/usr/local/opt/ruby/2.6.0/bundler/cli.rb:18:in `start'",
"/usr/local/opt/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:30:in `block in '",
"/usr/local/opt/ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'",
"/usr/local/opt/ruby/gems/2.6.0/gems/bundler-1.17.2/exe/bundle:22:in `'",
"/usr/local/opt/ruby/2.6.2/bin/bundle:23:in `load'",
"/usr/local/opt/ruby/2.6.2/bin/bundle:23:in `
'"
github-actions[bot] commented 3 years ago

This issue has been closed automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.