Skip to content

Commit b56b49f

Browse files
committed
Clarify docs, closes #13666
1 parent 1e0559e commit b56b49f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/ex_unit/lib/ex_unit/callbacks.ex

+7-9
Original file line numberDiff line numberDiff line change
@@ -538,15 +538,13 @@ defmodule ExUnit.Callbacks do
538538
test, as simply shutting down the process would cause it to be restarted
539539
according to its `:restart` value.
540540
541-
Another advantage is that the test process will act as both an ancestor
542-
as well as a caller to the supervised processes. When a process is started
543-
under a supervision tree, it typically populates the `$ancestors` key in
544-
its process dictionary with all of its ancestors, which will include the test
545-
process. Additionally, `start_supervised/2` will also store the test process
546-
in the `$callers` key of the started process, allowing tools that perform
547-
either ancestor or caller tracking to reach the test process. You can learn
548-
more about these keys in
549-
[the `Task` module](`Task#module-ancestor-and-caller-tracking`).
541+
Finally, since Elixir v1.17.0, the test supervisor has both `$ancestors`
542+
and `$callers` key in its process dictionary pointing to the test process.
543+
This means developers can invoke `Process.get(:"$callers", [])` in their
544+
`start_link` function and forward it to the spawned process, which may set
545+
`Process.put(:"$callers", callers)` during its initialization. This may be
546+
useful in projects who track process ownership during tests. You can learn
547+
more about these keys in [the `Task` module](`Task#module-ancestor-and-caller-tracking`).
550548
"""
551549
@doc since: "1.5.0"
552550
@spec start_supervised(Supervisor.child_spec() | module | {module, term}, keyword) ::

0 commit comments

Comments
 (0)