# `MishkaCmsCore.Test.Boot`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.3/lib/mishka_cms_core/test/boot.ex#L5)

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)
    end

The `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.

# `start!`

```elixir
@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: its `Oban` config is
    `Application.fetch_env!(otp_app, Oban)`, and `AshAuthentication.Supervisor` runs for it.
  * `:repo` (required) — the repo the suite writes through, the one
    `config :mishka_cms_core, repo: …` names. Oban's tables are created in it first
    (`MishkaCmsCore.Test.ObanMigration`): they are not an Ash resource, so `mix ash.codegen` never
    emits them.
  * `:endpoint` (required) — the suite's endpoint, started last.
  * `:plugins` — the `mishka_installer` plugins 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` — the `node_modules` directory the suite's esbuild `NODE_PATH` names, filled from
    `deps/` (`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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
