我遇到的一个问题是我的test/support
的过去没有得到编译:
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
我决定在运行mix test
时检查环境,令我惊讶的是:dev
pry(1)> Mix.env()
:dev
我是否缺少一些其他配置?
混合文件:
defmodule ProjectWeb.MixProject do
use Mix.Project
def project do
[
app: :project,
version: "0.1.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixirc_paths: elixirc_paths(Mix.env),
elixir: "~> 1.6",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
mod: {ProjectWeb.Application, []}
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:dev), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:phoenix, "~> 1.3.3"},
{:pre_plug, "~> 1.0"},
{:cowboy, "~> 1.0"},
{:phoenix_live_reload, "~> 1.1", only: :dev}
]
end
end