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

unable to run mix coveralls because of MIX_ENV #195

Open
talhaazeemmughal opened this issue Oct 29, 2024 · 2 comments
Open

unable to run mix coveralls because of MIX_ENV #195

talhaazeemmughal opened this issue Oct 29, 2024 · 2 comments

Comments

@talhaazeemmughal
Copy link

i have defined it like this in config.exs:

{project_path, 0} = System.cmd("pwd", [])
project_path = String.replace(project_path, ~r/\n/, "/")

if Mix.env() == :dev do
  config :git_hooks,
    auto_install: true,
    verbose: true,
    hooks: [
      pre_commit: [
        tasks: [
          # clean the build
          {:mix_task, :clean},
          # Checking code formatting
          {:mix_task, :format, ["--dry-run", "--check-formatted"]},
          # Checking retired deps
          {:mix_task, "hex.audit"},
          # Security audit of deps
          {:mix_task, "deps.audit"},
          # Finding unused dependencies
          {:mix_task, "deps.unlock", ["--check-unused"]},
          # Verifying test coverage
          {:cmd, "mix coveralls"}
        ]
      ]
    ],
    project_path: project_path
end

mix coveralls doesn't execute if i pass it as {:mix_task, :coveralls} that is why i passed it as cmd but the issue is that some of the test cases fails while mix coveralls is getting executed in pre commit it is getting executed in dev environment. no test cases fail if i normally execute mix coveralls

@talhaazeemmughal
Copy link
Author

even if i go with {:mix_task, :test, ["--trace"]} i still have the same issue.

P.s. I already tried what is mentioned in this issue

@qgadrian
Copy link
Owner

P.s. I already tried what is mentioned in this issue

@talhaazeemmughal I assume you mean this solution preferred_cli_env: [{:"git_hooks.run", :test}]

Could you please provide a sample project to reproduce the issue and help me provide a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants