运行混合测试时,在:dev env上正常吗?

时间:2018-08-13 07:37:15

标签: elixir mix

我遇到的一个问题是我的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

0 个答案:

没有答案