Skip to content

Commit

Permalink
Use GitPath to expect resolved path
Browse files Browse the repository at this point in the history
See comment from the code, TLDR macOS /var is a symlink to /priv/var
and tests fail because of that
  • Loading branch information
qgadrian committed Nov 29, 2024
1 parent 953ae0a commit 648b49d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/mix/tasks/git_hooks/install_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ defmodule Mix.Tasks.InstallTest do

hooks_file = Install.run(["--dry-run", "--quiet"])

# Use the resolved git path to fix symlinks on SO (such as macOS)
# This is not ideal, but using `Path.expand(project_path)` instead
# is not working because in macOS /var is a symlink to /private/var
resolved_project_path = GitHooks.Git.GitPath.resolve_app_path()

assert hooks_file == [
pre_commit: expect_hook_template("pre_commit", project_path),
pre_push: expect_hook_template("pre_push", project_path)
pre_commit: expect_hook_template("pre_commit", resolved_project_path),
pre_push: expect_hook_template("pre_push", resolved_project_path)
]
end)
end
Expand Down

0 comments on commit 648b49d

Please sign in to comment.