You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of the examples seem to be silently swallowed by RSpec in some circumstances.
I've reduced it to:
# spec/rubocop/config_loader_spec.rbRSpec.describeRuboCop::ConfigLoaderdoincludeFileHelperinclude_context'cli spec behavior'beforedodescribed_class.debug=true# Force reload of default configurationdescribed_class.default_configuration=nilendafter{described_class.debug=false}describe'.configuration_from_file',:isolated_environmentdosubject(:configuration_from_file)dodescribed_class.configuration_from_file(file_path)endcontext'when a new cop is introduced'dodefcop_enabled?(cop_class)configuration_from_file.for_cop(cop_class).fetch('Enabled')endlet(:file_path){'.rubocop.yml'}let(:cop_class){RuboCop::Cop::Metrics::MethodLength}beforedocreate_file('~/.rubocop.yml',<<~YAML) Metrics/MethodLength: Enabled: complete_nonsense YAMLcreate_file(file_path,config)endcontext'no errors'dolet(:config){''}it('nothing to fail'){}endcontext'when not configured explicitly'dolet(:config){['inherit_from: ~/.rubocop.yml']}it'is disabled'doexpect(cop_enabled?(cop_class)).toeq'pending'endendendendend
The culprit is this line (mistake in the config file):
Enabled: complete_nonsense
Expected behavior
The underlying failure is reported.
Actual behavior
$ rspec --format documentation spec/rubocop/config_loader_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 36379
RuboCop::ConfigLoader
.configuration_from_file
when a new cop is introduced
no errors
nothing to fail
when not configured explicitly
Finished in 0.04127 seconds (files took 4.97 seconds to load)
2 examples, 0 failures
Randomized with seed 36379
$ rspec --format documentation spec/rubocop/config_loader_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 48762
RuboCop::ConfigLoader
.configuration_from_file
when a new cop is introduced
when not configured explicitly
Finished in 0.01265 seconds (files took 1.77 seconds to load)
1 example, 0 failures
Randomized with seed 48762
Steps to reproduce the problem
Replace spec/rubocop/config_loader_spec.rb with the contents above.
Run the following command several times. Notice different number of examples executed being reported.
The different number of examples that get run is due to random order of examples. I can trigger the two orders on my system by adding --order rand:0 or --order rand:1 to the rspec call.
Randomized with seed 55055
RuboCop::ConfigLoader
.configuration_from_file
when a new cop is introduced
when not configured explicitly
configuration from /tmp/d20191224-19344-qc68ry/work/.rubocop.yml
Inheriting configuration from /tmp/d20191224-19344-qc68ry/home/.rubocop.yml
Property Enabled of cop Metrics/MethodLength is supposed to be a boolean and complete_nonsense is not.
which "terminates execution immediately". That explains why RSpec stops running further examples. This should probably be replaced by raising some exception.
buehmann
added a commit
to buehmann/rubocop
that referenced
this issue
Dec 25, 2019
Some of the examples seem to be silently swallowed by RSpec in some circumstances.
I've reduced it to:
The culprit is this line (mistake in the config file):
Expected behavior
The underlying failure is reported.
Actual behavior
Steps to reproduce the problem
Replace
spec/rubocop/config_loader_spec.rb
with the contents above.Run the following command several times. Notice different number of examples executed being reported.
RuboCop version
The text was updated successfully, but these errors were encountered: