Skip to content

Commit

Permalink
fix(test): flush msgs after tests to eliminate order-dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
zachallaun committed Aug 12, 2023
1 parent 670d82f commit b390483
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/next_ls/runtime_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ defmodule NextLs.RuntimeTest do

on_init = fn msg -> send(me, msg) end

on_exit(&flush_messages/0)

[logger: logger, cwd: Path.absname(tmp_dir), on_init: on_init]
end

Expand Down Expand Up @@ -238,4 +240,12 @@ defmodule NextLs.RuntimeTest do
assert {:error, :not_ready} = Runtime.compile(pid)
end
end

defp flush_messages do
receive do
_ -> flush_messages()
after
0 -> :ok
end
end
end

0 comments on commit b390483

Please sign in to comment.