Skip to content

Commit 38c9cce

Browse files
agundyalinmarsh
authored andcommitted
Check if ExUnit is available before setting up after suite calls
1 parent c144c92 commit 38c9cce

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

lib/wallaby/session_store.ex

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ defmodule Wallaby.SessionStore do
3636
Process.flag(:trap_exit, true)
3737
tid = :ets.new(name, opts)
3838

39-
Application.ensure_all_started(:ex_unit)
40-
41-
ExUnit.after_suite(fn _ ->
42-
try do
43-
:ets.tab2list(tid)
44-
|> Enum.each(&delete_sessions/1)
45-
rescue
46-
_ -> nil
47-
end
48-
end)
39+
if Code.ensure_loaded?(ExUnit) do
40+
Application.ensure_all_started(:ex_unit)
41+
42+
ExUnit.after_suite(fn _ ->
43+
try do
44+
:ets.tab2list(tid)
45+
|> Enum.each(&delete_sessions/1)
46+
rescue
47+
_ -> nil
48+
end
49+
end)
50+
end
4951

5052
{:ok, %{ets_table: tid}}
5153
end

0 commit comments

Comments
 (0)