File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -612,6 +612,19 @@ defmodule ExUnit.Callbacks do
612612
613613 Note that if the started process terminates before it is linked to the test process,
614614 this function will exit with reason `:noproc`.
615+
616+ > #### To link or not to link {: .warning}
617+ >
618+ > When using `start_link_supervised!/2`, the test process will be linked to the
619+ > spawned processes. When the test process exits, it exits with reason `:shutdown`,
620+ > and the crash signal propagates to all linked processes virtually simultaneously,
621+ > which can lead to processes terminating in an unpredictable order if they are not
622+ > trapping exits. This is particularly problematic when you have processes that the
623+ > test starts with `start_link_supervised!/2` and that depend on each other.
624+ >
625+ > If you need guaranteed shutdown order, use `start_supervised!/2`. This way the
626+ > test process exiting does not affect the started processes, and they will be shut down
627+ > *by the test supervisor* in reverse order, ensuring graceful termination.
615628 """
616629 @ doc since: "1.14.0"
617630 @ spec start_link_supervised! ( Supervisor . child_spec ( ) | module | { module , term } , keyword ) ::
You can’t perform that action at this time.
0 commit comments