Skip to content
Closed
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/lock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule Mix.Dep.Lock do
def write(map, opts \\ []) do
lockfile = opts[:file] || lockfile()

if map != read() do
if map != read(lockfile) do
if Keyword.get(opts, :check_locked, false) do
Mix.raise(
"Your #{lockfile} is out of date and must be updated without the --check-locked flag"
Expand Down
11 changes: 11 additions & 0 deletions lib/mix/test/mix/dep/lock_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ defmodule Mix.Dep.LockTest do
end)
end

test "does not raise with check_locked when custom lockfile is unchanged", context do
in_tmp(context.test, fn ->
custom_lockfile = Path.expand("custom.lock")

Mix.Dep.Lock.write(%{foo: :bar})
Mix.Dep.Lock.write(%{bar: :baz}, file: custom_lockfile)

Mix.Dep.Lock.write(%{bar: :baz}, file: custom_lockfile, check_locked: true)
end)
end

test "raises a proper error if check_locked opt is true and there are changes", context do
in_tmp(context.test, fn ->
Mix.Dep.Lock.write(%{foo: :bar})
Expand Down
Loading