Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct mixfile path on error messages when custom MIX_EXS #13288

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/mix/lib/mix/dep/loader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ defmodule Mix.Dep.Loader do
end

defp mix_children(config, locked?, opts) do
from = Path.absname("mix.exs")
from = Mix.Project.project_file()

(config[:deps] || [])
|> Enum.map(&to_dep(&1, from, _manager = nil, locked?))
Expand Down
12 changes: 6 additions & 6 deletions lib/mix/test/mix/tasks/deps_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ defmodule Mix.Tasks.DepsTest do

test "fails on diverged dependencies on get/update" do
in_fixture("deps_status", fn ->
Mix.Project.push(ConflictDepsApp)
Mix.Project.push(ConflictDepsApp, "mix.exs")

assert_raise Mix.Error, fn ->
Mix.Tasks.Deps.Loadpaths.run([])
Expand Down Expand Up @@ -608,11 +608,11 @@ defmodule Mix.Tasks.DepsTest do
end)
end

@overriding_msg " the dependency git_repo in mix.exs is overriding"
@overriding_msg " the dependency git_repo in custom/deps_repo/mix.exs is overriding"

test "fails on diverged dependencies even when optional" do
in_fixture("deps_status", fn ->
Mix.Project.push(ConvergedDepsApp)
Mix.Project.push(ConvergedDepsApp, "custom/deps_repo/mix.exs")

File.write!("custom/deps_repo/mix.exs", """
defmodule DepsRepo do
Expand Down Expand Up @@ -700,15 +700,15 @@ defmodule Mix.Tasks.DepsTest do

test "converged dependencies errors if not overriding" do
in_fixture("deps_status", fn ->
Mix.Project.push(NonOverriddenDepsApp)
Mix.Project.push(NonOverriddenDepsApp, "custom_mix.exs")

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

receive do
{:mix_shell, :error, [" the dependency git_repo in mix.exs" <> _ = msg]} ->
assert msg =~ "In mix.exs:"
{:mix_shell, :error, [" the dependency git_repo in custom_mix.exs" <> _ = msg]} ->
assert msg =~ "In custom_mix.exs:"

assert msg =~
"{:git_repo, \"0.1.0\", [env: :prod, git: #{inspect(fixture_path("git_repo"))}]}"
Expand Down
Loading