Starts what a suite run on its own needs around the core — the part a host's application starts in a deployment — so the core's suite and an extension's boot the same way.
if Mix.Project.config()[:app] == :my_extension do
:ok =
MishkaCmsCore.Test.Boot.start!(
otp_app: :my_extension,
repo: MyExtension.Repo,
endpoint: MyExtension.TestEndpoint,
plugins: MishkaCmsCore.Application.plugins() ++ MyExtension.Application.plugins(),
sweep: ["Elixir.MishkaCmsCore.Test.Plugins.", "Elixir.MyExtension.Test.Plugins."],
js_assets: Path.expand("../priv/static/temp/js_assets/node_modules", __DIR__)
)
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(MyExtension.Repo, :manual)
endThe ExUnit.configure/1, ExUnit.start/0 and sandbox-mode lines stay in each test_helper.exs:
they are the suite's, not the runtime's.
The core's own application has already started MishkaCmsCore.PubSub, mishka_installer's
registry and the core's plugins by the time a test helper runs, as it has in a host.
Summary
Functions
Boots the suite's runtime under MishkaCmsCore.TestSupervisor, and answers :ok once the plugins
it names are live.
Functions
@spec start!(keyword()) :: :ok
Boots the suite's runtime under MishkaCmsCore.TestSupervisor, and answers :ok once the plugins
it names are live.
:otp_app(required) — the suite's application: itsObanconfig isApplication.fetch_env!(otp_app, Oban), andAshAuthentication.Supervisorruns for it.:repo(required) — the repo the suite writes through, the oneconfig :mishka_cms_core, repo: …names. Oban's tables are created in it first (MishkaCmsCore.Test.ObanMigration): they are not an Ash resource, somix ash.codegennever emits them.:endpoint(required) — the suite's endpoint, started last.:plugins— themishka_installerplugins the run waits on before the first test (MishkaCmsCore.Test.Installer.await/2). Default[].:sweep— module-name prefixes of the suite's own test plugins; a registration an earlier run left behind under one of them is removed (MishkaCmsCore.Test.Installer.sweep!/1). Default[].:js_assets— thenode_modulesdirectory the suite's esbuildNODE_PATHnames, filled fromdeps/(MishkaCmsCore.Test.JsAssets.install!/1). Left alone when not given.:extra_children— more children, started after the endpoint. Default[].
The children are the repo, Oban, MishkaCmsCore.Supervision.children(:caches) and
children(:engine) — what a host starts around its repo and endpoint — then
AshAuthentication.Supervisor, the endpoint and :extra_children. Never children(:boot): a
test builds the sites it needs.