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

Utilities for observing messages delivered to a process during a function run.

These helpers are intended for troubleshooting concurrent tests where mailbox
visibility is important. They integrate with `ConcurrentHarness` reports but
can also be used standalone.

# `trace_messages`

```elixir
@spec trace_messages(pid(), (-&gt; any()), keyword()) :: %{
  messages: [term()],
  result: term(),
  initial_mailbox: [term()],
  final_mailbox: [term()]
}
```

Traces messages received by `pid` while executing `fun`.

Returns a map with the traced messages in arrival order, along with the
original mailbox snapshots and the wrapped function result.

---

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