parroty / excoveralls

Coverage report tool for Elixir with coveralls.io integration.
MIT License
821 stars 178 forks source link

** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1 #275

Open kianmeng opened 2 years ago

kianmeng commented 2 years ago

Steps to reproduce this:

git clone https://github.com/devinus/poison.git
cd poison
asdf install
mix deps.get
mix coveralls.github

Stacktrace:

** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1          

    The following arguments were given to IO.chardata_to_string/1:      

        # 1                                                                               
        nil                                                                               

    Attempted function clauses (showing 2 out of 2):          

        def chardata_to_string(string) when is_binary(string)
        def chardata_to_string(list) when is_list(list)

    (elixir 1.13.0-rc.1) lib/io.ex:627: IO.chardata_to_string/1
    (elixir 1.13.0-rc.1) lib/file.ex:341: File.read/1
    (elixir 1.13.0-rc.1) lib/file.ex:350: File.read!/1
    (excoveralls 0.14.4) lib/excoveralls/github.ex:84: ExCoveralls.Github.event_info/0
    (excoveralls 0.14.4) lib/excoveralls/github.ex:56: ExCoveralls.Github.get_committer_na
me/0
    (excoveralls 0.14.4) lib/excoveralls/github.ex:93: ExCoveralls.Github.git_info/0
    (excoveralls 0.14.4) lib/excoveralls/github.ex:25: ExCoveralls.Github.generate_json/2
    (excoveralls 0.14.4) lib/excoveralls/github.ex:8: ExCoveralls.Github.execute/2
    (mix 1.13.0-rc.1) lib/mix/tasks/test.ex:537: Mix.Tasks.Test.do_run/3
    (mix 1.13.0-rc.1) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (excoveralls 0.14.4) lib/mix/tasks.ex:54: Mix.Tasks.Coveralls.do_run/2
    (mix 1.13.0-rc.1) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.0-rc.1) lib/mix/cli.ex:84: Mix.CLI.run_task/2
    (elixir 1.13.0-rc.1) lib/code.ex:1183: Code.require_file/2
duane-strikwerda commented 2 years ago

I think you might be experiencing a duplicate of this issue

kianmeng commented 2 years ago

@duane-strikwerda Thanks. Error message seemed similar but I think I was running mix coveralls.github locally, exception was raised because required GitHub environment variable was not found.

@parroty Okay to switch to System.fetch_env!/1 in github.ex?

   31   defp get_env!(env) do
   32     env
   33     |> System.fetch_env!
   34   end

So the exception will give us a more specific error? Something like below:

** (ArgumentError) could not fetch environment variable "GITHUB_EVENT_PATH" because it is 
not set
anrgl commented 1 year ago

Hi @kianmeng! Were you able to run on githab without this error?