# `Supertester.UnifiedTestFoundation`
[🔗](https://github.com/nshkrdotcom/supertester/blob/v0.6.0/lib/supertester/unified_test_foundation.ex#L1)

Isolation runtime for OTP-heavy tests.

This module configures and maintains isolation contexts that can be plugged into any
test harness. Use `Supertester.ExUnitFoundation` for the ready-made ExUnit adapter, or
call the functions in this module directly from custom harnesses.

## Isolation Modes

- `:basic` - Basic isolation with unique naming
- `:registry` - Registry-based process isolation
- `:full_isolation` - Complete process and ETS isolation
- `:contamination_detection` - Isolation with contamination detection

## Usage with ExUnit

    defmodule MyApp.MyModuleTest do
      use Supertester.ExUnitFoundation, isolation: :full_isolation

      test "my test", context do
        # Test runs with full isolation
      end
    end

## Usage with custom harnesses

    :ok = Supertester.UnifiedTestFoundation.setup_isolation(:full_isolation, context)

# `__using__`
*macro* 

Deprecated macro maintained for backwards compatibility.

# `add_cleanup_callback`

```elixir
@spec add_cleanup_callback(Supertester.IsolationContext.t(), (-&gt; any())) ::
  Supertester.IsolationContext.t()
```

Adds a cleanup callback to the isolation context.

# `add_tracked_ets_table`

```elixir
@spec add_tracked_ets_table(Supertester.IsolationContext.t(), term()) ::
  Supertester.IsolationContext.t()
```

Adds a tracked ETS table to the isolation context.

# `add_tracked_process`

```elixir
@spec add_tracked_process(
  Supertester.IsolationContext.t(),
  Supertester.IsolationContext.process_info()
) ::
  Supertester.IsolationContext.t()
```

Adds a tracked process to the isolation context.

# `fetch_isolation_context`

```elixir
@spec fetch_isolation_context() :: Supertester.IsolationContext.t() | nil
```

Fetches the isolation context stored in the current process.

# `isolation_allows_async?`

```elixir
@spec isolation_allows_async?(atom()) :: boolean()
```

Returns whether the isolation type allows async testing.

# `isolation_timeout`

```elixir
@spec isolation_timeout(atom()) :: non_neg_integer()
```

Returns the timeout for the isolation type.

# `put_isolation_context`

```elixir
@spec put_isolation_context(Supertester.IsolationContext.t() | nil) ::
  Supertester.IsolationContext.t() | nil
```

Stores the isolation context in the current process.

# `setup_isolation`

```elixir
@spec setup_isolation(atom(), map()) :: {:ok, map()}
```

Sets up test isolation based on the specified isolation type.

# `verify_test_isolation`

```elixir
@spec verify_test_isolation(map()) :: boolean()
```

Verifies test isolation has been maintained.

# `wait_for_supervision_tree_ready`

```elixir
@spec wait_for_supervision_tree_ready(pid(), non_neg_integer()) ::
  {:ok, pid()} | {:error, :timeout}
```

Waits for a supervision tree to be ready.

---

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