Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to trace: NoMethodError: undefined method start_with? #31

Open
akicho8 opened this issue Sep 25, 2019 · 1 comment
Open

Failed to trace: NoMethodError: undefined method start_with? #31

akicho8 opened this issue Sep 25, 2019 · 1 comment

Comments

@akicho8
Copy link

akicho8 commented Sep 25, 2019

Get the following error

power_assert: [BUG] Failed to trace: NoMethodError: undefined method `start_with?' for nil:NilClass

It was validated as much as possible in a small code.
But I do not know the cause.

Capybara be due to? Or there is cause to power_assert?

Even now the same result by testing it with github of master.

Steps to reproduce

RUBY_VERSION # => "2.6.1"

require 'bundler/inline'

gemfile(true) do
  gem 'capybara', '3.29.0'
  gem 'selenium-webdriver', '3.142.4'
  gem 'test-unit', '3.3.3'
  gem 'power_assert', '1.1.5'
end

require 'capybara/dsl'
Capybara.current_driver = :selenium_chrome

class TestFoo < Test::Unit::TestCase
  test 'case1' do
    Capybara.visit('http://httpbin.org/forms/post')
    assert { Capybara.first('input').value == '' }
  end
end

Expected behavior

ruby test.rb
Loaded suite test
Started
.
Finished in 2.373814 seconds.
-------------------------------------------------------------------------------
1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-------------------------------------------------------------------------------
0.42 tests/s, 0.42 assertions/s

Actual behavior

ruby test.rb
Loaded suite test
Started
power_assert: [BUG] Failed to trace: NoMethodError: undefined method `start_with?' for nil:NilClass
.
Finished in 2.373814 seconds.
-------------------------------------------------------------------------------
1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
-------------------------------------------------------------------------------
0.42 tests/s, 0.42 assertions/s

System configuration

Ruby version: 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin17]

@k-tsj
Copy link
Member

k-tsj commented Oct 6, 2019

It seems a third party's issue.

I added following debug code,

diff --git a/vendor/bundle/ruby/2.6.0/gems/power_assert-1.1.5/lib/power_assert.rb b/vendor/bundle/ruby/2.6.0/gems/power_assert-1.1.5/lib/power_assert.rb
index 7eaa5f9..996f03e 100644
--- a/vendor/bundle/ruby/2.6.0/gems/power_assert-1.1.5/lib/power_assert.rb
+++ b/vendor/bundle/ruby/2.6.0/gems/power_assert-1.1.5/lib/power_assert.rb
@@ -53,6 +53,7 @@ def trace(frame)
     end

     def app_caller_locations
+      pp caller_locations: caller_locations.zip(caller_locations.map(&:path))
       caller_locations.drop_while {|i| internal_file?(i.path) }.take_while {|i| ! internal_file?(i.path) }
     end

and got following output.

...
{:caller_locations=>
...
   ["test.rb:1:in `each'", nil],
   ["test.rb:1:in `each'", nil],
   ["test.rb:1:in `each'", nil],
   ["test.rb:1:in `each'", nil]]}

It is obviously strange that Thread::Backtrace::Location#path returns nil instead of "test.rb".

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

No branches or pull requests

2 participants