diff --git a/test/microwaveprop/logger_format_test.exs b/test/microwaveprop/logger_format_test.exs index 30b148a2..50dcf948 100644 --- a/test/microwaveprop/logger_format_test.exs +++ b/test/microwaveprop/logger_format_test.exs @@ -2,12 +2,18 @@ defmodule Microwaveprop.LoggerFormatTest do # async: false — we briefly swap the global :default :logger handler's # formatter and forward its output to a self()-bound IO device so the # test can capture the JSON-encoded output. Restored on exit. + # + # Opts out of the suite-wide capture_log flag — capture_log hot-swaps + # the :default handler for its own capture handler, so our direct + # :logger.get_handler_config(:default) lookup in setup would 404. use ExUnit.Case, async: false alias LoggerJSON.Formatters.Basic require Logger + @moduletag capture_log: false + describe "structured JSON formatter" do setup do {:ok, handler_cfg} = :logger.get_handler_config(:default) diff --git a/test/microwaveprop_web/live/contact_map_live_test.exs b/test/microwaveprop_web/live/contact_map_live_test.exs index 8c3c6b4a..4523dbc2 100644 --- a/test/microwaveprop_web/live/contact_map_live_test.exs +++ b/test/microwaveprop_web/live/contact_map_live_test.exs @@ -6,7 +6,7 @@ defmodule MicrowavepropWeb.ContactMapLiveTest do alias Microwaveprop.Radio.Contact alias Microwaveprop.Repo - defp create_contact(attrs \\ %{}) do + defp create_contact(attrs) do default = %{ station1: "W5XD", station2: "K5TR", diff --git a/test/microwaveprop_web/telemetry_test.exs b/test/microwaveprop_web/telemetry_test.exs index 6b3207d9..00c72a10 100644 --- a/test/microwaveprop_web/telemetry_test.exs +++ b/test/microwaveprop_web/telemetry_test.exs @@ -93,8 +93,10 @@ defmodule MicrowavepropWeb.TelemetryTest do {:ok, pid} = Supervisor.start_link(Telemetry, :ok, name: sup_name) assert Process.alive?(pid) - on_exit = fn -> if Process.alive?(pid), do: Process.exit(pid, :kill) end - on_exit.() + # Unlink before tearing down so the brutal-kill exit signal doesn't + # propagate to the test process (which trap_exit defaults to off). + Process.unlink(pid) + Process.exit(pid, :kill) end end end diff --git a/test/mix/tasks/simple_tasks_test.exs b/test/mix/tasks/simple_tasks_test.exs index 20cb2c9b..17e7866c 100644 --- a/test/mix/tasks/simple_tasks_test.exs +++ b/test/mix/tasks/simple_tasks_test.exs @@ -118,8 +118,6 @@ defmodule Mix.Tasks.SimpleTasksTest do end test "enqueues jobs for the top hours when contacts exist" do - import Ecto.Query - # Seed one contact so top_hours_by_contact_count returns something. {:ok, _contact} = %Contact{} diff --git a/test/test_helper.exs b/test/test_helper.exs index 62f1ca42..718d7007 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,2 +1,2 @@ -ExUnit.start(exclude: [:slow]) +ExUnit.start(exclude: [:slow], capture_log: true) Ecto.Adapters.SQL.Sandbox.mode(Microwaveprop.Repo, :manual)