There is actually some difference with trap_exit. This is the result when running the test without trap_exit:
22:18:38.400 [error] GenServer #PID<0.1224.0> terminating
** (Ecto.NoResultsError) expected at least one result but got none in query:
from c0 in Myapp.Configs.ConfigFile,
where: c0.user_id == ^"0e18a0a4-ff7f-4e09-acf1-311063a5409d",
where: c0.id == ^"0dc74e3f-afc1-4f59-81ad-d4f5921d4099"
(ecto 3.9.5) lib/ecto/repo/queryable.ex:161: Ecto.Repo.Queryable.one!/3
(myapp_web 0.1.0) lib/myapp_web/live/config_file_live/index.ex:43: MyappWeb.ConfigFileLive.Index.handle_event/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /Users/james/Developer/myapp/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F1Rg6djBAQKBKwZo", event: "event", payload: %{"cid" => nil, "event" => "delete", "type" => "hook", "value" => %{"id" => "0dc74e3f-afc1-4f59-81ad-d4f5921d4099"}}, ref: "1", join_ref: 0}
22:18:38.415 [error] GenServer #PID<0.1222.0> terminating
** (Ecto.NoResultsError) expected at least one result but got none in query:
from c0 in Myapp.Configs.ConfigFile,
where: c0.user_id == ^"0e18a0a4-ff7f-4e09-acf1-311063a5409d",
where: c0.id == ^"0dc74e3f-afc1-4f59-81ad-d4f5921d4099"
(ecto 3.9.5) lib/ecto/repo/queryable.ex:161: Ecto.Repo.Queryable.one!/3
(myapp_web 0.1.0) lib/myapp_web/live/config_file_live/index.ex:43: MyappWeb.ConfigFileLive.Index.handle_event/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /Users/james/Developer/myapp/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {:EXIT, #PID<0.1219.0>, {%Ecto.NoResultsError{message: "expected at least one result but got none in query:\n\nfrom c0 in Myapp.Configs.ConfigFile,\n where: c0.user_id == ^\"0e18a0a4-ff7f-4e09-acf1-311063a5409d\",\n where: c0.id == ^\"0dc74e3f-afc1-4f59-81ad-d4f5921d4099\"\n"}, [{Ecto.Repo.Queryable, :one!, 3, [file: 'lib/ecto/repo/queryable.ex', line: 161]}, {MyappWeb.ConfigFileLive.Index, :handle_event, 3, [file: 'lib/myapp_web/live/config_file_live/index.ex', line: 43]}, {Phoenix.LiveView.Channel, :"-view_handle_event/3-fun-0-", 3, [file: 'lib/phoenix_live_view/channel.ex', line: 401]}, {:telemetry, :span, 3, [file: '/Users/james/Developer/myapp/deps/telemetry/src/telemetry.erl', line: 321]}, {Phoenix.LiveView.Channel, :handle_info, 2, [file: 'lib/phoenix_live_view/channel.ex', line: 221]}, {:gen_server, :try_dispatch, 4, [file: 'gen_server.erl', line: 1123]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 1200]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
1) test Index doesn't delete config_files owned by other users (MyappWeb.ConfigFileLiveTest)
apps/myapp_web/test/myapp_web/live/config_file_live_test.exs:112
** (EXIT from #PID<0.1219.0>) an exception was raised:
** (Ecto.NoResultsError) expected at least one result but got none in query:
from c0 in Myapp.Configs.ConfigFile,
where: c0.user_id == ^"0e18a0a4-ff7f-4e09-acf1-311063a5409d",
where: c0.id == ^"0dc74e3f-afc1-4f59-81ad-d4f5921d4099"
(ecto 3.9.5) lib/ecto/repo/queryable.ex:161: Ecto.Repo.Queryable.one!/3
(myapp_web 0.1.0) lib/myapp_web/live/config_file_live/index.ex:43: MyappWeb.ConfigFileLive.Index.handle_event/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /Users/james/Developer/myapp/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
This is the result with trap_exit:
22:16:05.903 [error] GenServer #PID<0.1224.0> terminating
** (Ecto.NoResultsError) expected at least one result but got none in query:
from c0 in Myapp.Configs.ConfigFile,
where: c0.user_id == ^"5cef925d-65c6-420c-9c7e-f0a08f374958",
where: c0.id == ^"815ef352-e223-4b98-886b-e0a73af9f6e3"
(ecto 3.9.5) lib/ecto/repo/queryable.ex:161: Ecto.Repo.Queryable.one!/3
(myapp_web 0.1.0) lib/myapp_web/live/config_file_live/index.ex:43: MyappWeb.ConfigFileLive.Index.handle_event/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /Users/james/Developer/myapp/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F1RgxlbcCS-BKwQF", event: "event", payload: %{"cid" => nil, "event" => "delete", "type" => "hook", "value" => %{"id" => "815ef352-e223-4b98-886b-e0a73af9f6e3"}}, ref: "1", join_ref: 0}
1) test Index doesn't delete config_files owned by other users (MyappWeb.ConfigFileLiveTest)
apps/myapp_web/test/myapp_web/live/config_file_live_test.exs:112
** (exit) exited in: Phoenix.LiveViewTest.call(#Phoenix.LiveViewTest.View<id: "phx-F1RgxlbcCS-BKwQF", module: MyappWeb.ConfigFileLive.Index, pid: #PID<0.1224.0>, endpoint: MyappWeb.Endpoint, ...>)
** (EXIT) an exception was raised:
** (Ecto.NoResultsError) expected at least one result but got none in query:
from c0 in Myapp.Configs.ConfigFile,
where: c0.user_id == ^"5cef925d-65c6-420c-9c7e-f0a08f374958",
where: c0.id == ^"815ef352-e223-4b98-886b-e0a73af9f6e3"
(ecto 3.9.5) lib/ecto/repo/queryable.ex:161: Ecto.Repo.Queryable.one!/3
(myapp_web 0.1.0) lib/myapp_web/live/config_file_live/index.ex:43: MyappWeb.ConfigFileLive.Index.handle_event/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /Users/james/Developer/myapp/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.18.18) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3