Skip to content

Commit

Permalink
Clarify docs, closes #13666
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jun 15, 2024
1 parent 6c935ca commit 6f5fc94
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/ex_unit/lib/ex_unit/callbacks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -535,15 +535,13 @@ defmodule ExUnit.Callbacks do
test, as simply shutting down the process would cause it to be restarted
according to its `:restart` value.
Another advantage is that the test process will act as both an ancestor
as well as a caller to the supervised processes. When a process is started
under a supervision tree, it typically populates the `$ancestors` key in
its process dictionary with all of its ancestors, which will include the test
process. Additionally, `start_supervised/2` will also store the test process
in the `$callers` key of the started process, allowing tools that perform
either ancestor or caller tracking to reach the test process. You can learn
more about these keys in
[the `Task` module](`Task#module-ancestor-and-caller-tracking`).
Finally, since Elixir v1.17.0, the test supervisor has both `$ancestors`
and `$callers` key in its process dictionary pointing to the test process.
This means developers can invoke `Process.get(:"$callers", [])` in their
`start_link` function and forward it to the spawned process, which may set
`Process.put(:"$callers", callers)` during its initialization. This may be
useful in projects who track process ownership during tests. You can learn
more about these keys in [the `Task` module](`Task#module-ancestor-and-caller-tracking`).
"""
@doc since: "1.5.0"
@spec start_supervised(Supervisor.child_spec() | module | {module, term}, keyword) ::
Expand Down

0 comments on commit 6f5fc94

Please sign in to comment.