Skip to content

stop error backtrace at framework#59

Merged
joeldrapper merged 1 commit intoyippee-fun:mainfrom
pushcx:backtrace_flag
Feb 28, 2025
Merged

stop error backtrace at framework#59
joeldrapper merged 1 commit intoyippee-fun:mainfrom
pushcx:backtrace_flag

Conversation

@pushcx
Copy link
Contributor

@pushcx pushcx commented Feb 28, 2025

./test/invocation.test.rb:37
  call
    unexpected ArgumentError
      wrong number of arguments (given 1, expected 0)
        ./test/invocation.test.rb:39:in 'block (3 levels) in load_tests'
          /home/pushcx/code/hotcake/lib/hotcake.rb:86:in 'Invocation#call'
            ./test/invocation.test.rb:41:in 'block (2 levels) in Quickdraw::Runner#load_tests'
              /opt/rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/bundler/gems/quickdraw-06b3b5f9ae7a/lib/quickdraw/test.rb:20:in 'BasicObject#instance_exec'
                /opt/rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/bundler/gems/quickdraw-06b3b5f9ae7a/lib/quickdraw/test.rb:20:in 'block in Quickdraw::Test#run'
                  /opt/rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/bundler/gems/quickdraw-06b3b5f9ae7a/lib/quickdraw/test.rb:102:in 'Quickdraw::Test#around_test'
                    /opt/rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/bundler/gems/quickdraw-06b3b5f9ae7a/lib/quickdraw/test.rb:20:in 'Quickdraw::Test#run'
                      /opt/rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/bundler/gems/quickdraw-06b3b5f9ae7a/lib/quickdraw/runner.rb:147:in 'block (2 levels) in Quickdraw::Runner#work'

Passed: 32 | Failed: 0 | Errors: 1

As a Quickdraw user, it is not at all useful to backtrace into the framework. That's just distraction I have to read around. I made it an option because I've managed to eventually get every testing tool to throw an exception eventually.

Maybe it's worth a teensy risk to drop the option and write this something like: take_while { |it| error["backtrace"].first.include?("Quickdraw::") || !it.include?('Quickdraw::Runner') } so that full backtrace only prints when the exception originates in Quickdraw.

I originally opened this code to fix the apparent bug with the increasing indentation, but it looks like that's an intentional style choice that I just strongly disagree with.

(Speaking of which, this is the first time I have seen Ruby indented with tabs. I feel like offering a feature PR permits one small piece of bikeshedding. Or more productively: I have gotten a lot of peace of mind by using standardrb, disabling Lint/UselessAssignment (breaks things mid-refactor) and never thinking about style.)

@joeldrapper joeldrapper merged commit 3e9a6af into yippee-fun:main Feb 28, 2025
5 of 11 checks passed
exit
end

parser.on("-b", "--backtrace", "Backtrace past test into Quickdraw") do |it|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confess that I do not immediately grok this sentence.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means the backtrace should go past the tests and into the framework code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using backtrace as a verb. Maybe "Continue backtrace past test into Quickdraw" would be more obvious?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants