           ]
         end
       end
-      """
+      """)
 
       assert_raise Mix.Error, fn ->
-        Mix.Tasks.Deps.Get.run []
-        Mix.Tasks.Deps.Loadpaths.run []
-      end
-
-      assert_received {:mix_shell, :error, ["  the dependency git_repo in mix.exs is overriding" <> _]}
+        Mix.Tasks.Deps.Get.run([])
+        Mix.Tasks.Deps.Loadpaths.run([])
+      end
+
+      assert_received {:mix_shell, :error, [@overriding_msg <> _]}
     end
   end
 
   test "works with converged dependencies" do
-    Mix.Project.push ConvergedDepsApp
-
-    in_fixture "deps_status", fn ->
-      Mix.Tasks.Deps.Get.run []
+    Mix.Project.push(ConvergedDepsApp)
+
+    in_fixture "deps_status", fn ->
+      Mix.Tasks.Deps.Get.run([])
       message = "* Getting git_repo (#{fixture_path("git_repo")})"
       assert_received {:mix_shell, :info, [^message]}
 

          [elixir: "~> 0.1.0", app: :ok, version: "2.0.0"]
        end
      end
      """

      Mix.Tasks.Deps.Compile.run [:ok]

      msg = "warning: the dependency :ok requires Elixir \"~> 0.1.0\" " <>
            "but you are running on v#{System.version}"
      assert_received {:mix_shell, :error, [^msg]}

      Mix.Tasks.Deps.Compile.run []
    end
  end

  test "prints list of dependencies and their lock status" do
    Mix.Project.push DepsApp

    in_fixture "deps_status", fn ->
      File.cd!("deps/ok", fn -> System.cmd("git", ["init"]) end)

      Mix.Tasks.Deps.run []
      assert_received {:mix_shell, :info, ["* ok (https://github.com/elixir-lang/ok.git) (mix)"]}
      assert_received {:mix_shell, :info, ["  the dependency is not locked. To generate the \"mix.lock\" file run \"mix deps.get\""]}

      Mix.Dep.Lock.write %{ok: {:git, "https://github.com/elixir-lang/ok.git", "abcdefghi", []}}
      Mix.Tasks.Deps.run []

      assert_received {:mix_shell, :info, ["* ok (https://github.com/elixir-lang/ok.git) (mix)"]}
      assert_received {:mix_shell, :info, ["  locked at abcdefg"]}
      assert_received {:mix_shell, :info, ["  lock mismatch: the dependency is out of date. To fetch locked version run \"mix deps.get\""]}

      Mix.Dep.Lock.write %{ok: {:git, "git://github.com/elixir-lang/another.git", "abcdefghi", []}}
      Mix.Tasks.Deps.run []

      assert_received {:mix_shell, :info, ["* ok (https://github.com/elixir-lang/ok.git) (mix)"]}
      assert_received {:mix_shell, :info, ["  lock outdated: the lock is outdated compared to the options in your mix.exs. To fetch locked version run \"mix deps.get\""]}
    end
  end

  test "cleans and recompiles artifacts if --force given" do
    Mix.Project.push SuccessfulDepsApp

    in_fixture "deps_status", fn ->
      Mix.Tasks.Deps.Compile.run []
      File.touch! "_build/dev/lib/ok/clean-me"

      Mix.Tasks.Deps.Compile.run ["--force"]
      refute File.exists? "_build/dev/lib/ok/clean-me"
    end
  end

  ## deps.loadpaths

  test "checks list of dependencies and their status with success" do
    Mix.Project.push SuccessfulDepsApp

    in_fixture "deps_status", fn ->
      Mix.Tasks.Deps.Loadpaths.run []
    end
  end

  test "checks list of dependencies and their status on failure" do
    Mix.Project.push DepsApp

    in_fixture "deps_status", fn ->
      assert_raise Mix.Error, fn ->
        Mix.Tasks.Deps.Loadpaths.run []
      end

      assert_received {:mix_shell, :error, ["* ok (https://github.com/elixir-lang/ok.git)"]}
      assert_received {:mix_shell, :error, ["  the dependency is not available, run \"mix deps.get\""]}
      assert_received {:mix_shell, :error, ["* invalidvsn (deps/invalidvsn)"]}
      assert_received {:mix_shell, :error, ["  the app file contains an invalid version: :ok"]}
      assert_received {:mix_shell, :error, ["* invalidapp (deps/invalidapp)"]}
      assert_received {:mix_shell, :error, ["  the app file at \"_build/dev/lib/invalidapp/ebin/invalidapp.app\" is invalid"]}

      # This one is compiled automatically
      refute_received {:mix_shell, :error, ["* noappfile (deps/noappfile)"]}
      refute_received {:mix_shell, :error, ["  could not find an app file at \"_build/dev/lib/noappfile/ebin/noappfile.app\"" <> _]}
    end
  end

  test "compiles and prunes builds per environment" do
    Mix.Project.push SuccessfulDepsApp

    in_fixture "deps_status", fn ->
      # Start from scratch!
      File.rm_rf("_build")

      Mix.Tasks.Deps.Compile.run []
      Mix.Tasks.Deps.Loadpaths.run []
      assert File.exists?("_build/dev/lib/ok/ebin/ok.app")
      assert File.exists?("_build/dev/lib/ok/priv/sample")

      Mix.Tasks.Compile.run []
      assert to_charlist(Path.expand("_build/dev/lib/ok/ebin/")) in :code.get_path
      assert File.exists?("_build/dev/lib/sample/ebin/sample.app")

      # Remove the deps but set build_path, deps won't be pruned, but load paths are
      Mix.ProjectStack.post_config [deps: [], build_path: "_build"]
      Mix.ProjectStack.clear_cache
      Mix.Project.pop
      Mix.Project.push SuccessfulDepsApp

      Mix.Tasks.Deps.Loadpaths.run []
      refute to_charlist(Path.expand("_build/dev/lib/ok/ebin/")) in :code.get_path
      assert File.exists?("_build/dev/lib/ok/ebin/ok.app")
      assert File.exists?("_build/dev/lib/sample/ebin/sample.app")

      # Remove the deps without build_path, deps will be pruned
      Mix.ProjectStack.post_config [deps: []]
      Mix.ProjectStack.clear_cache
      Mix.Project.pop
      Mix.Project.push SuccessfulDepsApp

      Mix.Tasks.Deps.Loadpaths.run []
      refute File.exists?("_build/dev/lib/ok/ebin/ok.app")
      assert File.exists?("_build/dev/lib/sample/ebin/sample.app")
    end

      File.mkdir_p!("_build/dev/lib/ok")
      File.mkdir_p!("_build/test/lib/ok")

      message =
        "\"mix deps.clean\" expects dependencies as arguments or " <>
          "a flag indicating which dependencies to clean. " <>
          "The --all option will clean all dependencies while " <>
          "the --unused option cleans unused dependencies"

      assert_raise Mix.Error, message, fn ->
        Mix.Tasks.Deps.Clean.run([])
      end

      Mix.Tasks.Deps.Clean.run(["--only", "dev", "--all"])
      refute File.exists?("_build/dev/lib/git_repo")
      refute File.exists?("_build/dev/lib/ok")
      assert File.exists?("_build/test/lib/git_repo")
      assert File.exists?("_build/dev/lib/raw_sample")

      Mix.Tasks.Deps.Clean.run(["--all"])
      refute File.exists?("_build/dev/lib/git_repo")
      refute File.exists?("_build/test/lib/git_repo")
      assert File.exists?("_build/dev/lib/raw_sample")
