TestProbe
Defined in: src/testkit/TestProbe.ts:24
A lightweight ActorRef that captures every tell for inspection by tests.
Unlike an ordinary actor it is synchronous and not driven by the dispatcher —
messages sit in an internal queue until a test asserts on them.
Extends
Section titled “Extends”ActorRef<unknown>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TestProbe(
system,opts?):TestProbe
Defined in: src/testkit/TestProbe.ts:38
Parameters
Section titled “Parameters”system
Section titled “system”TestProbeOptions = {}
Returns
Section titled “Returns”TestProbe
Overrides
Section titled “Overrides”Properties
Section titled “Properties”
readonlypath:ActorPath
Defined in: src/testkit/TestProbe.ts:25
Overrides
Section titled “Overrides”Accessors
Section titled “Accessors”messageCount
Section titled “messageCount”Get Signature
Section titled “Get Signature”get messageCount():
number
Defined in: src/testkit/TestProbe.ts:58
Number of messages currently buffered.
Returns
Section titled “Returns”number
sender
Section titled “sender”Get Signature
Section titled “Get Signature”get sender():
ActorRef<unknown> |null
Defined in: src/testkit/TestProbe.ts:64
The sender of the LAST message consumed via expect* / receive*.
Returns
Section titled “Returns”ActorRef<unknown> | null
Methods
Section titled “Methods”clearInbox()
Section titled “clearInbox()”clearInbox():
void
Defined in: src/testkit/TestProbe.ts:73
Clear all buffered messages — handy between test phases.
Returns
Section titled “Returns”void
equals()
Section titled “equals()”equals(
other):boolean
Defined in: src/ActorRef.ts:26
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”expectMsg()
Section titled “expectMsg()”expectMsg<
T>(expected,timeoutMs?):Promise<T>
Defined in: src/testkit/TestProbe.ts:90
Assert the next message deep-equals expected.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”expected
Section titled “expected”T
timeoutMs?
Section titled “timeoutMs?”number
Returns
Section titled “Returns”Promise<T>
expectMsgType()
Section titled “expectMsgType()”expectMsgType<
T>(Class,timeoutMs?):Promise<T>
Defined in: src/testkit/TestProbe.ts:99
Assert the next message is an instance of Class.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”(…args) => T
timeoutMs?
Section titled “timeoutMs?”number
Returns
Section titled “Returns”Promise<T>
expectNoMessage()
Section titled “expectNoMessage()”expectNoMessage(
timeoutMs?):Promise<void>
Defined in: src/testkit/TestProbe.ts:111
Assert NO message arrives within the timeout.
Parameters
Section titled “Parameters”timeoutMs?
Section titled “timeoutMs?”number = 300
Returns
Section titled “Returns”Promise<void>
fishForMessage()
Section titled “fishForMessage()”fishForMessage<
T>(pred,timeoutMs?):Promise<T>
Defined in: src/testkit/TestProbe.ts:138
Receive messages until pred returns true. Other messages are discarded.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”(m) => boolean
timeoutMs?
Section titled “timeoutMs?”number = ...
Returns
Section titled “Returns”Promise<T>
hasMessage()
Section titled “hasMessage()”hasMessage():
boolean
Defined in: src/testkit/TestProbe.ts:61
True when there is at least one buffered message waiting to be consumed.
Returns
Section titled “Returns”boolean
kill()
Section titled “kill()”kill():
void
Defined in: src/ActorRef.ts:22
Kill this actor — raises ActorKilledError through the normal supervision path.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”receiveN()
Section titled “receiveN()”receiveN(
n,timeoutMs?):Promise<unknown[]>
Defined in: src/testkit/TestProbe.ts:83
Receive the next n messages.
Parameters
Section titled “Parameters”number
timeoutMs?
Section titled “timeoutMs?”number
Returns
Section titled “Returns”Promise<unknown[]>
receiveOne()
Section titled “receiveOne()”receiveOne(
timeoutMs?):Promise<unknown>
Defined in: src/testkit/TestProbe.ts:78
Wait for the next message and return it. Throws on timeout.
Parameters
Section titled “Parameters”timeoutMs?
Section titled “timeoutMs?”number
Returns
Section titled “Returns”Promise<unknown>
reply()
Section titled “reply()”reply(
message):void
Defined in: src/testkit/TestProbe.ts:67
Convenience: reply to the last sender (throws if there is none).
Parameters
Section titled “Parameters”message
Section titled “message”unknown
Returns
Section titled “Returns”void
send()
Section titled “send()”send(
message):void
Defined in: src/ActorRef.ts:16
Alias for tell — useful if you want to pipe something.
Parameters
Section titled “Parameters”message
Section titled “message”unknown
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”stop()
Section titled “stop()”stop():
void
Defined in: src/ActorRef.ts:19
Gracefully stop this actor after it drains its mailbox.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”tell()
Section titled “tell()”tell(
message,sender?):void
Defined in: src/testkit/TestProbe.ts:45
Send a message to this actor. sender is surfaced as context.sender in the recipient.
Parameters
Section titled “Parameters”message
Section titled “message”unknown
sender?
Section titled “sender?”ActorRef<unknown> | null
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”toString()
Section titled “toString()”toString():
string
Defined in: src/ActorRef.ts:24
Returns
Section titled “Returns”string