Supertester.MessageHarness (Supertester v0.6.0)

Copy Markdown View Source

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.

Summary

Functions

Traces messages received by pid while executing fun.

Functions

trace_messages(pid, fun, opts \\ [])

@spec trace_messages(pid(), (-> 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.