Skip to content

Commit

Permalink
✅ Fix flickering test (#114)
Browse files Browse the repository at this point in the history
Use `start_supervised!` for the `DummyRunner` agent to avoid `already_started` errors.
  • Loading branch information
randycoulman authored Sep 21, 2024
1 parent c8b88a5 commit 6e217c2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/mix_test_interactive/end_to_end_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ defmodule MixTestInteractive.EndToEndTest do

defmodule DummyRunner do
@moduledoc false
use Agent

def start_link(test_pid) do
Agent.start_link(fn -> test_pid end, name: __MODULE__)
end

def run(config, args) do
Agent.update(__MODULE__, fn test_pid ->
send(test_pid, {config, args})
Expand All @@ -19,13 +25,12 @@ defmodule MixTestInteractive.EndToEndTest do
@settings %Settings{}

setup do
test_pid = self()
{:ok, _} = Agent.start_link(fn -> test_pid end, name: DummyRunner)

{:ok, io} = StringIO.open("")
Process.group_leader(self(), io)

{:ok, pid} = start_supervised({InteractiveMode, config: @config, name: :end_to_end, settings: @settings})
_pid = start_supervised!({DummyRunner, self()})
pid = start_supervised!({InteractiveMode, config: @config, name: :end_to_end, settings: @settings})

%{pid: pid}
end

Expand Down

0 comments on commit 6e217c2

Please sign in to comment.