elixir-tools / credo-language-server

LSP implementation for Credo.
MIT License
96 stars 11 forks source link

Running tests gets an error #33

Closed CoderDennis closed 1 year ago

CoderDennis commented 1 year ago

I get the following error when running mix test:

14:17:12.699 [notice] Protocol 'inet_tcp': register/listen error: econnrefused

** (MatchError) no match of right hand side value: {:error, {{:shutdown, {:failed_to_start_child, :net_kernel, {:EXIT, :nodistribution}}}, {:child, :undefined, :net_sup_dynamic, {:erl_distribution, :start_link, [%{clean_halt: false, name: :credo_language_server, name_domain: :shortnames, net_tickintensity: 4, net_ticktime: 60, supervisor: :net_sup_dynamic}]}, :permanent, false, 1000, :supervisor, [:erl_distribution]}}}
    test/test_helper.exs:2: (file)
    (elixir 1.14.4) lib/code.ex:1260: Code.require_file/2

It doesn't look like it has actually run any of the tests.

I'm running on an M2 MacBook Pro if that makes a difference.

mhanberg commented 1 year ago

i just merged some code last night that runs the user's code in an isolated node, and they connect through distributed erlang.

i am wondering if your epmd is not running

can you run epmd -daemon and then try again?

CoderDennis commented 1 year ago

I ran epmd -daemon and now all 8 tests fail with the same runtime error (PIDs are different each time):

test code actions outer module (CredoLanguageServerTest)
     test/credo_language_server_test.exs:181
     ** (RuntimeError) failed to start child with the spec {CredoLanguageServer, [buffer: #PID<0.666.0>, cache: #PID<0.663.0>, task_supervisor: #PID<0.662.0>, runtime: #PID<0.664.0>]}.
     Reason: an exception was raised:
         ** (RuntimeError) Failed to boot runtime
             (credo_language_server 0.0.5) lib/credo_language_server.ex:60: CredoLanguageServer.init/2
             (gen_lsp 0.1.1) lib/gen_lsp.ex:154: GenLSP.init/1
             (stdlib 4.3.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
     stacktrace:
       (ex_unit 1.14.4) lib/ex_unit/callbacks.ex:538: ExUnit.Callbacks.start_supervised!/2
       (gen_lsp 0.1.1) lib/gen_lsp/test.ex:38: GenLSP.Test.server/2
       test/credo_language_server_test.exs:18: CredoLanguageServerTest.__ex_unit_setup_0/1
       test/credo_language_server_test.exs:1: CredoLanguageServerTest.__ex_unit__/2
mhanberg commented 1 year ago

now try and cd into test/support/project and run mix deps.get && mix compile

i'm still working through how this new isolated node is going to work, and am confused why output from the node is not being sent to the LSP

CoderDennis commented 1 year ago

After that, I get 7 out of 8 tests passing. The one that fails is test publishes diagnostics once the client has initialized (CredoLanguageServerTest) with Assertion failed, no matching message after 1000ms

Nevermind, that failure is because of a change I made locally. The main branch passes all tests. ;)

mhanberg commented 1 year ago

Nice, I'll close this issue but we'll get it figured out.