rspec-tracer-0.1.0/lib/rspec_tracer/filter.rb:65:in `match?': undefined method `[]' for nil:NilClass
dorianmariecom opened this issue · 8 comments
~/s/socializus> bundle exec rspec
Started RSpec tracer
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
RSpec tracer is running 44 examples (actual: 44, skipped: 0)
............................................
Finished in 1 minute 43.3 seconds (files took 10.77 seconds to load)
44 examples, 0 failures
RSpec tracer is generating reports
/Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer/filter.rb:65:in `match?': undefined method `[]' for nil:NilClass (NoMethodError)
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer/runner.rb:114:in `block (2 levels) in register_untraced_dependency'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer/runner.rb:114:in `any?'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer/runner.rb:114:in `block in register_untraced_dependency'
from /Users/dorianmariefr/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/set.rb:344:in `each_key'
from /Users/dorianmariefr/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/set.rb:344:in `each'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer/runner.rb:111:in `register_untraced_dependency'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer.rb:195:in `generate_tracer_reports'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer.rb:186:in `generate_reports'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer.rb:176:in `run_exit_tasks'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer.rb:75:in `at_exit_behavior'
from /Users/dorianmariefr/.rvm/gems/ruby-3.0.2/gems/rspec-tracer-0.1.0/lib/rspec_tracer/defaults.rb:9:in `block in <top (required)>'
That's odd. https://github.com/avmnu-sng/rspec-tracer/blob/main/lib/rspec_tracer/source_file.rb#L10 returns false
for the file path. Would it be possible for you to put a binding.pry
here https://github.com/avmnu-sng/rspec-tracer/blob/main/lib/rspec_tracer/runner.rb#L110 and check the list?
> untraced_files
=> #<Set: {"/Users/dorianmariefr/src/socializus/spec/spec_helper.rb",
"/Users/dorianmariefr/src/socializus/spec/rspec/instafail.rb"}>
> trace_point_files
=> #<Set: {"/Users/dorianmariefr/src/socializus/app/helpers/format_helper.rb"}>
Thanks, @dorianmariefr, which one of these two files doesn't exist? The trace_point_files
should always be valid, so I guess, I am doing something wrong when generating RSpec
required files.
right, "/Users/dorianmariefr/src/socializus/spec/rspec/instafail.rb"
doesn't exist, instafail comes from the https://github.com/grosser/rspec-instafail gem
Got it. I assumed that the .rspec
file --require
will always exist in the project. I'll work on a fix.
@dorianmariefr Can you try it out using gem 'rspec-tracer', github: 'avmnu-sng/rspec-tracer'
before I release?
nice it works:
~/s/socializus> rspec spec/models/
Started RSpec tracer
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
RSpec tracer is running 28 examples (actual: 28, skipped: 0)
............................
Finished in 17.46 seconds (files took 9.94 seconds to load)
28 examples, 0 failures
RSpec tracer is generating reports
RSpec tracer reports generated to /Users/dorianmariefr/src/socializus/rspec_tracer_cache/1e61d938cb1b573af4d7a26d86b5ad18
RSpecTracer generated HTML report to /Users/dorianmariefr/src/socializus/rspec_tracer_report/index.html
Coverage report generated for RSpecTracer to /Users/dorianmariefr/src/socializus/rspec_tracer_coverage/coverage.json. 416 / 570 LOC (72.98%) covered
~/s/socializus> rspec spec/models/
Started RSpec tracer
RSpec tracer loaded cache from /Users/dorianmariefr/src/socializus/rspec_tracer_cache/1e61d938cb1b573af4d7a26d86b5ad18
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
RSpec tracer is running 0 examples (actual: 28, skipped: 28)
Finished in 0.23173 seconds (files took 8.73 seconds to load)
0 examples, 0 failures
RSpec tracer is generating reports
RSpec tracer reports generated to /Users/dorianmariefr/src/socializus/rspec_tracer_cache/1e61d938cb1b573af4d7a26d86b5ad18
RSpecTracer generated HTML report to /Users/dorianmariefr/src/socializus/rspec_tracer_report/index.html
Coverage report generated for RSpecTracer to /Users/dorianmariefr/src/socializus/rspec_tracer_coverage/coverage.json. 401 / 553 LOC (72.51%) covered
@dorianmariefr v0.2.0
is released with the fix.