File size: 1,326 Bytes
6778ee0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | if not Enum.empty?(Path.wildcard("lib/**/*_test.exs")) do
raise "Oops, test(s) found in `lib/` directory. Move them to `test/`."
end
{:ok, _} = Application.ensure_all_started(:ex_machina)
if Mix.env() != :e2e_test do
Mox.defmock(Plausible.HTTPClient.Mock, for: Plausible.HTTPClient.Interface)
Mox.defmock(Plausible.DnsLookup.Mock,
for: Plausible.DnsLookupInterface
)
Application.ensure_all_started(:double)
FunWithFlags.enable(:annotations)
Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, :manual)
end
# warn about minio if it's included in tests but not running
if :minio in Keyword.fetch!(ExUnit.configuration(), :include) do
Plausible.TestUtils.ensure_minio()
end
default_exclude = [:slow, :minio, :migrations]
# avoid slowdowns contacting the code server
for {app, _, _} <- Application.loaded_applications() do
if modules = Application.spec(app, :modules) do
Code.ensure_all_loaded(modules)
end
end
case Mix.env() do
:ce_test ->
IO.puts("Test mode: Community Edition")
ExUnit.configure(exclude: [:ee_only, :e2e | default_exclude])
:e2e_test ->
IO.puts("Test mode: End-to-End Tests")
ExUnit.configure(exclude: [:test], include: [:e2e])
_ ->
IO.puts("Test mode: Enterprise Edition")
ExUnit.configure(exclude: [:ce_build_only, :e2e | default_exclude])
end
|