2024-04-16 21:30:20 +03:00
|
|
|
if not Enum.empty?(Path.wildcard("lib/**/*_test.exs")) do
|
|
|
|
raise "Oops, test(s) found in `lib/` directory. Move them to `test/`."
|
|
|
|
end
|
|
|
|
|
2019-09-02 14:29:19 +03:00
|
|
|
{:ok, _} = Application.ensure_all_started(:ex_machina)
|
2022-09-23 13:22:43 +03:00
|
|
|
Mox.defmock(Plausible.HTTPClient.Mock, for: Plausible.HTTPClient.Interface)
|
2020-02-26 11:54:21 +03:00
|
|
|
Application.ensure_all_started(:double)
|
2024-04-04 13:54:23 +03:00
|
|
|
|
|
|
|
# Temporary flag to test `experimental_reduced_joins` flag on all tests.
|
|
|
|
if System.get_env("TEST_EXPERIMENTAL_REDUCED_JOINS") == "1" do
|
|
|
|
FunWithFlags.enable(:experimental_reduced_joins)
|
|
|
|
else
|
|
|
|
FunWithFlags.disable(:experimental_reduced_joins)
|
|
|
|
end
|
|
|
|
|
2019-09-02 14:29:19 +03:00
|
|
|
Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, :manual)
|
2023-11-20 14:52:20 +03:00
|
|
|
|
2024-04-11 10:15:01 +03:00
|
|
|
# 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
|
|
|
|
|
2024-04-29 09:05:33 +03:00
|
|
|
if Mix.env() == :ce_test do
|
2024-05-14 09:56:55 +03:00
|
|
|
IO.puts("Test mode: Community Edition")
|
2024-04-29 09:05:33 +03:00
|
|
|
ExUnit.configure(exclude: [:slow, :minio, :ee_only])
|
2023-11-20 14:52:20 +03:00
|
|
|
else
|
2024-04-29 09:05:33 +03:00
|
|
|
IO.puts("Test mode: Enterprise Edition")
|
|
|
|
ExUnit.configure(exclude: [:slow, :minio, :ce_build_only])
|
2023-11-20 14:52:20 +03:00
|
|
|
end
|