Skip to content

Bullet does not show stack-trace on test env #491

@victorhazbun

Description

@victorhazbun

When I run the specs I got the following logs which are not complete since they do not include the full stack trace:

Bullet::Notification::UnoptimizedQueryError:
  user: victorhazbun

  AVOID eager loading detected
    AffiliateBrand => [:parent]
    Remove from your query: .includes([:parent])
  Call stack
    /Users/victorhazbun/Code/my-app/spec/support/bullet.rb:12:in `block (2 levels) in <top (required)>'
# ./spec/support/bullet.rb:12:in `block (2 levels) in <top (required)>'

I have the following setup in a spec helper.

RSpec.configure do |config|
  config.before(:each, bullet: true) do
    Bullet.enable = true
    Bullet.bullet_logger = true
    Bullet.raise = true # raise an error if n+1 query occurs
    Bullet.start_request
  end

  config.after(:each, bullet: true) do
    Bullet.perform_out_of_channel_notifications if Bullet.notification?
    Bullet.end_request
    Bullet.enable = false
    Bullet.bullet_logger = false
    Bullet.raise = false
  end
end

NOTE: The full stack trace only appears when N+1 issues occur, but not for unused eager loading issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions