Skip to content

Commit

Permalink
Do not add phoenix_live_view config on API apps, closes #5840
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jun 14, 2024
1 parent d8f7144 commit e336b25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion installer/templates/phx_single/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ config :swoosh, :api_client, false<% end %>
config :logger, level: :warning

# Initialize plugs at runtime for faster test compilation
config :phoenix, :plug_init_mode, :runtime<%= if @live do %>
config :phoenix, :plug_init_mode, :runtime<%= if @html do %>

# Enable helpful, but potentially expensive runtime checks
config :phoenix_live_view,
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_umbrella/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ config :<%= @app_name %>, <%= @app_module %>.Mailer,
config :swoosh, :api_client, false<% end %>

# Initialize plugs at runtime for faster test compilation
config :phoenix, :plug_init_mode, :runtime<%= if @live do %>
config :phoenix, :plug_init_mode, :runtime<%= if @html do %>

# Enable helpful, but potentially expensive runtime checks
config :phoenix_live_view,
Expand Down
8 changes: 4 additions & 4 deletions installer/test/phx_new_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,6 @@ defmodule Mix.Tasks.Phx.NewTest do
assert file =~ ~s|# socket "/live"|
refute file =~ ~s|plug Phoenix.LiveDashboard.RequestLogger|
end)

assert_file("phx_blog/config/test.exs", fn file ->
refute file =~ ~s|config :phoenix_live_view|
end)
end)
end

Expand Down Expand Up @@ -517,6 +513,10 @@ defmodule Mix.Tasks.Phx.NewTest do
assert file =~ ~s|pipe_through [:fetch_session, :protect_from_forgery]|
end)

assert_file("phx_blog/config/config.exs", fn file ->
refute file =~ ~s|config :phoenix_live_view|
end)

assert_file("phx_blog/config/test.exs", fn file ->
refute file =~ ~s|config :phoenix_live_view|
end)
Expand Down

0 comments on commit e336b25

Please sign in to comment.