elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.5k stars 198 forks source link

Tests with PropCheck start executing on compile #1000

Open lukaszsamson opened 1 year ago

lukaszsamson commented 1 year ago

Reported on slack

My ElixirLS is crashing when I view a test file that has use PropCheck at the top. I've been trying to figure out what I might be able to change/config/tweak, but having little success.

[Error - 2:53:36 PM] GenServer ElixirLS.LanguageServer.ExUnitTestTracer terminating
** (stop) exited in: GenServer.call(PropCheck.CounterStrike, {:counter_example, {MyApp.MyTest, :"property_is false for unintelligible canceledAt values", []}}, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.14.1) lib/gen_server.ex:1027: GenServer.call/3
    (propcheck 1.4.1) lib/properties.ex:162: PropCheck.Properties.tag_property/1
    test/all_events_timer_test.exs:76: anonymous fn/2 in :elixir_compiler_3.__MODULE__/1
    (ex_unit 1.14.1) lib/ex_unit/callbacks.ex:731: ExUnit.Callbacks.__describe__/4
    test/all_events_timer_test.exs:67: (module)
    (elixir 1.14.1) src/elixir_compiler.erl:65: :elixir_compiler.dispatch/4
    (elixir 1.14.1) src/elixir_compiler.erl:50: :elixir_compiler.compile/3
    (elixir 1.14.1) src/elixir_module.erl:379: :elixir_module.eval_form/6
Last message (from #PID<0.4179.0>): {:get_tests, "/Users/ngeraedts/code/test/my_app/my_test.exs"}
State: %{}
Client #PID<0.4179.0> is alive

    (stdlib 4.2) gen.erl:237: :gen.do_call/4
    (elixir 1.14.1) lib/gen_server.ex:1035: GenServer.call/3
    (language_server 0.16.0) lib/language_server/providers/execute_command/get_ex_unit_tests_in_file.ex:9: ElixirLS.LanguageServer.Providers.ExecuteCommand.GetExUnitTestsInFile.execute/2
    (language_server 0.16.0) lib/language_server/server.ex:807: anonymous fn/4 in ElixirLS.LanguageServer.Server.handle_request/2
    (language_server 0.16.0) lib/language_server/server.ex:845: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
[Info  - 2:53:36 PM] Connection to server got closed. Server will restart.

You're right... it does look like propcheck is executing the checks during macro compilation. :grimacing: https://github.com/alfert/propcheck/blob/master/lib/properties.ex#L132 Alright - not a LS issue. I'll see if I can post an issue on PropCheck to see if there's some way to avoid this issue.