mix-test hook is failing when the mix.exs file is committed
If the mix.exs file is being committed, the mix-test hook will fail with a compilation error:
$ git add mix.exs mix.lock
$ git commit -m "Update dependencies; use hound 1.1.1 instead of master"
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
mixed line ending........................................................Passed
mix format...............................................................Passed
mix test.................................................................Failed
- hook id: mix-test
- exit code: 1
warning: redefining module JailActivity.MixProject (current version defined in memory)
mix.exs:1
Excluding tags: [:selenium]
== Compilation error in file mix.exs ==
** (Mix.Error) Trying to load JailActivity.MixProject from "/Users/josh/codebase/elixir/ex-bexar-county-jail-activity/mix.exs" but another project with the same name was already defined at "/Users/josh/codebase/elixir/ex-bexar-county-jail-activity/mix.exs"
(mix 1.13.2) lib/mix.ex:515: Mix.raise/2
(stdlib 3.17) lists.erl:1267: :lists.foldl/3
(elixir 1.13.2) lib/kernel/parallel_compiler.ex:455: Kernel.ParallelCompiler.require_file/2
(elixir 1.13.2) lib/kernel/parallel_compiler.ex:348: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/7
This appears to be related to a strange parallelization issue in the pre-commit virtual environment.
Proposed fix: Update the mix-test file to exclude mix.exs so that the hook won't run if only mix.exs is being committed. The error could still occur if mix.exs is committed with other .ex or .exs files.