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

Can't debug unit tests: No implicit conversion of nil into String #17

Open
NigelSwinson opened this issue Mar 20, 2024 · 1 comment
Open

Comments

@NigelSwinson
Copy link

NigelSwinson commented Mar 20, 2024

This is reposting issue 2 from #16.

Trying to start the debugger triggers these errors.

[TypeError] no implicit conversion of nil into String
<internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in `require'
<internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in `require'
C:/Webserver/git/banking-import/noop.rb:1:in `<top (required)>'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/readapt-2.0.0/lib/readapt/debugger.rb:66:in `load'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/readapt-2.0.0/lib/readapt/debugger.rb:66:in `block (2 levels) in start'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/readapt-2.0.0/lib/re

I happen to be debugging a selenium test, which runs fine in Ruby directly (the thing I am troubleshooting connects to a DOM change in what I'm running against), but triggers this error when I try to run through Eclipse/SolarGraph/Readapt, meaning I don't get any interactive debugging.

The fault reproduces with this trivial rb file. Runs cleanly with 100% passed when run directly, but produces the error when run through solargraph/readapt

require "test/unit"

class Noop < Test::Unit::TestCase
def setup
end

def teardown
end

def test_main
end
end

It is not helped by the fact one of the messages gets truncated. There seems to be some kind of 355 character limit in the "output" lines. Eventually I found the Solargraph "Troubleshoot Readapt debugger by enabling adapter logs" checkbox. Hard to work out where this was going to put log messages, but eventually found the debug adapter logs had turned into JSON rather than raw text. But there's no real extra content:

Content-Length: 344

{"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"exceptionBreakpointFilters":[{"filter":"raise","label":"Break on raised exceptions","description":"The debugger will break when an exception is raised, regardless of whether it is subsequently rescued.","default":false}]}}Content-Length: 38

{"type":"event","event":"initialized"}Content-Length: 79

{"type":"response","request_seq":2,"success":true,"command":"launch","body":{}}Content-Length: 90

{"type":"response","request_seq":3,"success":true,"command":"configurationDone","body":{}}Content-Length: 108

{"type":"event","event":"process","body":{"name":""}}Content-Length: 74

{"type":"event","event":"thread","body":{"reason":"started","threadId":1}}Content-Length: 74

{"type":"event","event":"thread","body":{"reason":"started","threadId":1}}Content-Length: 129

{"type":"event","event":"output","body":{"output":"[TypeError] no implicit conversion of nil into String\n","category":"stderr"}}Content-Length: 331

{"type":"event","event":"output","body":{"output":"internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb:127:in require'\n<internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in require'\n:2:in `<top (require","category":"stderr"}}Content-Length: 333

I've been using these extensions without too much trouble for years (9?!?), and have very much appreciated them, so am sad they have now broken, and am hopeful repair isn't too difficult?

@NigelSwinson NigelSwinson changed the title No implicit conversion of nil into String Can't debug unit tests: No implicit conversion of nil into String Mar 21, 2024
@NigelSwinson
Copy link
Author

Some further testing. If my ruby script is as simple as the following, it works:

print "hello world"

But if I change my script to this it fails:

require "test-unit"

So is it some kind of compatibility fail between readapt and test-unit?

Can anyone reproduce this?

My gems:

C:\Users\Nigel>gem list

*** LOCAL GEMS ***

abbrev (0.1.2)
ast (2.4.2)
backport (1.2.0)
base64 (0.2.0)
benchmark (default: 0.3.0)
bigdecimal (3.1.6, default: 3.1.5)
bundler (2.5.6, default: 2.5.3)
cgi (default: 0.4.1)
csv (default: 3.2.8)
date (default: 3.3.4)
debug (1.9.1)
delegate (default: 0.3.1)
did_you_mean (default: 1.6.3)
diff-lcs (1.5.1)
digest (default: 3.1.1)
drb (2.2.1, default: 2.2.0)
e2mmap (0.1.0)
english (default: 0.8.0)
erb (4.0.4, default: 4.0.3)
error_highlight (default: 0.6.0)
etc (default: 1.4.3)
fcntl (default: 1.1.0)
fiddle (default: 1.1.2)
fileutils (default: 1.7.2)
find (default: 0.2.0)
forwardable (default: 1.3.3)
getoptlong (default: 0.2.1)
io-console (0.7.2, default: 0.7.1)
io-nonblock (default: 0.3.0)
io-wait (default: 0.3.1)
ipaddr (default: 1.2.6)
irb (1.12.0, default: 1.11.0)
jaro_winkler (1.5.6)
json (default: 2.7.1)
kramdown (2.4.0)
kramdown-parser-gfm (1.1.0)
language_server-protocol (3.17.0.3)
logger (default: 1.6.0)
matrix (0.4.2)
minitest (5.22.2, 5.20.0)
mutex_m (default: 0.2.0)
net-ftp (0.3.4, 0.3.3)
net-http (0.4.1, default: 0.4.0)
net-imap (0.4.10, 0.4.9)
net-pop (0.1.2)
net-protocol (0.2.2)
net-smtp (0.4.0.1, 0.4.0)
nkf (0.2.0, default: 0.1.3)
nokogiri (1.16.3 x64-mingw-ucrt)
observer (default: 0.1.2)
open-uri (default: 0.4.1)
open3 (default: 0.2.1)
openssl (default: 3.2.0)
optparse (default: 0.4.0)
ostruct (default: 0.6.0)
parallel (1.24.0)
parser (3.3.0.5)
pathname (default: 0.3.0)
pg (1.5.6)
power_assert (2.0.3)
pp (default: 0.5.0)
prettyprint (default: 0.2.0)
prime (0.1.2)
prism (0.24.0, default: 0.19.0)
pstore (default: 0.1.3)
psych (default: 5.1.2)
racc (1.7.3)
rainbow (3.1.1)
rake (13.1.0)
rbs (3.4.4, 3.4.0, 2.8.4)
rdoc (default: 6.6.2)
readapt (2.0.0)
readline (default: 0.0.4)
regexp_parser (2.9.0)
reline (0.4.3, default: 0.4.1)
resolv (default: 0.3.0)
resolv-replace (default: 0.1.1)
reverse_markdown (2.1.1)
rexml (3.2.6)
rinda (default: 0.2.0)
rss (0.3.0)
rubocop (1.62.1)
rubocop-ast (1.31.2)
ruby-progressbar (1.13.0)
ruby2_keywords (default: 0.0.5)
rubygems-update (3.5.6)
rubyzip (2.3.2)
securerandom (default: 0.3.1)
selenium-webdriver (4.18.1)
set (default: 1.1.0)
shellwords (default: 0.2.0)
singleton (default: 0.2.0)
solargraph (0.50.0)
stringio (default: 3.1.0)
strscan (3.1.0, default: 3.0.7)
syntax_suggest (default: 2.0.0)
tempfile (default: 0.2.1)
test-unit (3.6.2, 3.6.1)
thor (1.3.1)
tilt (2.3.0)
time (default: 0.3.0)
timeout (0.4.1)
tmpdir (default: 0.2.0)
tsort (default: 0.2.0)
typeprof (0.21.11, 0.21.9)
un (default: 0.3.0)
unicode-display_width (2.5.0)
uri (0.13.0)
weakref (default: 0.1.3)
websocket (1.2.10)
win32ole (default: 1.8.10)
yaml (default: 0.3.0)
yard (0.9.36)
zlib (default: 3.1.0)

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

No branches or pull requests

1 participant