Skip to content

Commit cef2ccd

Browse files
authored
Merge pull request #63 from NexPB/plug-deps-test-only
refactor: enable `plug` deps for tests only
2 parents cc30380 + 42a91c2 commit cef2ccd

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
erlang 27.3.4.3
2+
elixir 1.18.4-otp-27

mix.exs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defmodule WebPushElixir.MixProject do
66
app: :web_push_elixir,
77
version: "0.4.0",
88
elixir: "~> 1.15",
9+
elixirc_paths: elixirc_paths(Mix.env()),
910
start_permanent: Mix.env() == :prod,
1011
deps: deps(),
1112
description: "Simple web push for Elixir",
@@ -25,16 +26,20 @@ defmodule WebPushElixir.MixProject do
2526
]
2627
end
2728

29+
# Specifies which paths to compile per environment.
30+
defp elixirc_paths(:test), do: ["lib", "test/support"]
31+
defp elixirc_paths(_), do: ["lib"]
32+
2833
# Run "mix help deps" to learn about dependencies.
2934
defp deps do
3035
[
31-
{:ex_doc, "~> 0.27", only: :dev, runtime: false},
32-
{:excoveralls, "~> 0.10", only: :test},
3336
{:jose, "~> 1.11"},
3437
{:jason, "~> 1.4"},
35-
{:plug, "~> 1.14"},
36-
{:plug_cowboy, "~> 2.0"},
37-
{:httpoison, "~> 2.0"}
38+
{:httpoison, "~> 2.0"},
39+
{:ex_doc, "~> 0.27", only: :dev, runtime: false},
40+
{:excoveralls, "~> 0.10", only: :test},
41+
{:plug, "~> 1.14", only: :test},
42+
{:plug_cowboy, "~> 2.0", only: :test}
3843
]
3944
end
4045
end
File renamed without changes.

test/test_helper.exs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
ExUnit.start()
22

3-
DynamicSupervisor.start_child(WebPushElixir.DynamicSupervisor,{Plug.Cowboy, scheme: :http, plug: WebPushElixir.MockServer, options: [port: 4040]})
3+
DynamicSupervisor.start_child(
4+
WebPushElixir.DynamicSupervisor,
5+
{Plug.Cowboy, scheme: :http, plug: WebPushElixir.MockServer, options: [port: 4040]}
6+
)

test/web_push_elixir_test.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
defmodule WebPushElixirTest do
22
use ExUnit.Case
33

4-
@subscription '{"endpoint":"http://localhost:4040/some-push-service","keys":{"p256dh":"BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM=","auth":"tBHItJI5svbpez7KI4CCXg=="}}'
4+
@subscription """
5+
{"endpoint":"http://localhost:4040/some-push-service","keys":{"p256dh":"BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM=","auth":"tBHItJI5svbpez7KI4CCXg=="}}
6+
"""
57

68
test "it should send notification" do
79
%{

0 commit comments

Comments
 (0)