#14·tldr

Private method `test' called for nil (NoMethodError)

Author: pusewiczCreated Oct 29, 2024Updated Oct 30, 2024
Labelsbug

When stack level too deep errors get raised, and there's more than one test, the default reporter ends up in a weird state and does not report things correctly:

bash
.gem/ruby/3.3.5/gems/tldr-0.10.0/lib/tldr/reporters/default.rb:83:in `block in after_suite': private method `test' called for nil (NoMethodError)

        test_results = test_results.sort_by { |result| [result.test.location.file, result.test.location.line] }

Minimal repro:

ruby
require "tldr"
TLDR::Run.at_exit! TLDR::Config.new

class SomeTest < TLDR
  def my_method
    my_method
  end

  def test_a
    my_method
  end

  def test_b
    my_method
  end
end