Skip to content

Commit 6f5fc94

Browse files
committed
Clarify docs, closes #13666
1 parent 6c935ca commit 6f5fc94

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Diff for: lib/ex_unit/lib/ex_unit/callbacks.ex

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

0 commit comments

Comments
 (0)