Skip to content

Commit

Permalink
Fix extraneous logging in test (#317)
Browse files Browse the repository at this point in the history
* Disabled logging in test

I have no idea why logs are appearing with the compile-time config. I
had to resort to calling Logger.configure() in test.exs. Something is up.

Fixes #297

* Extraneous logging releated fixes

 * Removed import from config.exs
 * Handled default case for ports exiting, which was causing a log
   message
 * Added lexical_test to plugin_runner's deps so we can run tests in
   its app directory
  • Loading branch information
scohen authored Aug 11, 2023
1 parent 822c89f commit 148d7a5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions apps/plugin_runner/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defmodule Lexical.Plugin.Runner.MixProject do
defp deps do
[
{:common, in_umbrella: true},
{:lexical_test, path: "../../projects/lexical_test", only: :test},
{:lexical_plugin, path: "../../projects/lexical_plugin", only: :test}
]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ defmodule Lexical.RemoteControl.ProjectNode do
{:noreply, %State{state | port: nil}}
end

@impl true
def handle_info({:EXIT, port, _}, state) when is_port(port) do
{:noreply, state}
end

@impl true
def handle_info(:timeout, %State{} = state) do
state = State.halt(state)
Expand Down
1 change: 0 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Config
alias Lexical.Server.JsonRpc.Backend, as: JsonRpcBackend

import_config("#{Mix.env()}.exs")
13 changes: 8 additions & 5 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import Config
alias Lexical.Server.JsonRpc
alias Lexical.Test.Transport.NoOp

Logger.remove_backend(:console)
Logger.remove_backend(JsonRpc.Backend)
config :logger, level: :error, backends: []

config :logger, level: :none
config :remote_control, edit_window_millis: 10

config :server, transport: NoOp

if Version.match?(System.version(), ">= 1.15.0") do
Logger.configure(level: :none)
else
Logger.remove_backend(:console)
Logger.remove_backend(JsonRpc.Backend)
end
2 changes: 1 addition & 1 deletion projects/lexical_plugin/config/test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Config

Logger.remove_backend(:console)
config :logger, level: :error
config :logger, level: :none

0 comments on commit 148d7a5

Please sign in to comment.