toptal / crystalball

Regression Test Selection library for your RSpec test suite
https://toptal.github.io/crystalball/
MIT License
322 stars 41 forks source link

NoMethodError: undefined method `merge_base' for nil:NilClass #138

Closed jeffsaremi closed 1 year ago

jeffsaremi commented 1 year ago

Trying Crystalball for the very first time. I executed this command first: CRYSTALBALL=true bundle exec rspec ./components/risk/spec/some_spec.rb

I got a seemingly-ok ./tmp/crystalball_data.yml

I made a trivial change to one of the ruby files mentioned in the above yml.

Now I'm running this: bundle exec crystalball And I get:

:~/app# bundle exec crystalball
I, [2023-03-25T23:49:12.315764 #3017]  INFO -- : Crystalball starts to glow...
W, [2023-03-25T23:49:12.325606 #3017]  WARN -- : Maps are outdated!
bundler: failed to load command: crystalball (/usr/local/bundle/bin/crystalball)
NoMethodError: undefined method `merge_base' for nil:NilClass
  /usr/local/bundle/gems/crystalball-0.7.0/lib/crystalball/predictor.rb:35:in `diff'
  /usr/local/bundle/gems/crystalball-0.7.0/lib/crystalball/predictor.rb:30:in `prediction'
  /usr/local/bundle/gems/crystalball-0.7.0/lib/crystalball/rspec/prediction_builder.rb:17:in `prediction'
  /usr/local/bundle/gems/crystalball-0.7.0/lib/crystalball/rspec/runner.rb:72:in `build_prediction'
  /usr/local/bundle/gems/crystalball-0.7.0/lib/crystalball/rspec/runner.rb:19:in `run'
  /usr/local/bundle/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
  /usr/local/bundle/gems/crystalball-0.7.0/bin/crystalball:5:in `<top (required)>'
  /usr/local/bundle/bin/crystalball:23:in `load'
  /usr/local/bundle/bin/crystalball:23:in `<top (required)>'

Additional Info:

 bundle info crystalball
  * crystalball (0.7.0)
        Summary: A library for RSpec regression test selection
        Homepage: https://github.com/toptal/crystalball
        Path: /usr/local/bundle/gems/crystalball-0.7.0
jeffsaremi commented 1 year ago

A little subtle thing that no one tells you is that crystalball needs to run in a git sandbox. That's how it detects what's changed.