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

team_city_ex_unit_formatting.ex does not handle ExUnit.Diff.container_to_algebra/5 output #1759

Closed
col opened this issue Apr 22, 2020 · 6 comments · Fixed by #1762
Closed
Assignees
Labels
Milestone

Comments

@col
Copy link

col commented Apr 22, 2020

Describe the bug
When a test fails the processes crashes and I don't get any test output in the console or in the test result pane.

To Reproduce
Steps to reproduce the behavior:

  1. Upgraded to Elixir 1.10.2
  2. Run a test that will fail
  3. See error

Expected behavior
I expect to see the log output of the test and the test pane to lists all the tests that have passed and failed.

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot 2020-04-22 at 11 16 26 AM

Logs

** (EXIT from #PID<0.92.0>) exited in: GenServer.stop(#PID<0.651.0>, :normal, :infinity)
    ** (EXIT) exited in: :sys.terminate(#PID<0.651.0>, :normal, :infinity)
        ** (EXIT) an exception was raised:
            ** (ArgumentError) argument error
                :erlang.iolist_to_binary([[[[] | "\e[31m"], {:doc_cons, {:doc_cons, "clauses:", " "}, "[%DarkKnightCore.Clause{operator: \"=\", regexes: nil, test_value: \"1000\", test_value_from_param: nil, transaction_param: \"amount\"}]"}] | "\e[0m"])
                /private/var/folders/35/1gtclsh54pg32bv2fss7z5d40000gn/T/intellij_elixir1/exunit/1.6.0/team_city_ex_unit_formatting.ex:236: TeamCityExUnitFormatting.colorize/2
                (elixir 1.10.2) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
                (elixir 1.10.2) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
                (ex_unit 1.10.2) lib/ex_unit/diff.ex:970: ExUnit.Diff.container_to_algebra/5
                (elixir 1.10.2) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
                (ex_unit 1.10.2) lib/ex_unit/diff.ex:970: ExUnit.Diff.container_to_algebra/5
                (ex_unit 1.10.2) lib/ex_unit/formatter.ex:377: ExUnit.Formatter.format_sides/6
                (ex_unit 1.10.2) lib/ex_unit/formatter.ex:365: ExUnit.Formatter.format_context/4
                (ex_unit 1.10.2) lib/ex_unit/formatter.ex:158: ExUnit.Formatter.format_assertion_error/6
                (ex_unit 1.10.2) lib/ex_unit/formatter.ex:190: ExUnit.Formatter.format_kind_reason/6
                (ex_unit 1.10.2) lib/ex_unit/formatter.ex:130: anonymous fn/7 in ExUnit.Formatter.format_test_failure/5
                (elixir 1.10.2) lib/enum.ex:1495: anonymous fn/2 in Enum.map_join/3
                (elixir 1.10.2) lib/enum.ex:3359: Enum.map_intersperse_list/3
                (elixir 1.10.2) lib/enum.ex:1495: Enum.map_join/3
                (ex_unit 1.10.2) lib/ex_unit/formatter.ex:129: ExUnit.Formatter.format_test_failure/5
                /private/var/folders/35/1gtclsh54pg32bv2fss7z5d40000gn/T/intellij_elixir1/exunit/1.6.0/team_city_ex_unit_formatting.ex:126: TeamCityExUnitFormatting.put_event/2
                /private/var/folders/35/1gtclsh54pg32bv2fss7z5d40000gn/T/intellij_elixir1/exunit/1.6.0/team_city_ex_unit_formatter.ex:11: TeamCityExUnitFormatter.handle_cast/2
                (stdlib 3.10) gen_server.erl:637: :gen_server.try_dispatch/4
                (stdlib 3.10) gen_server.erl:711: :gen_server.handle_msg/6
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed

Desktop:

  • OS: macOS
  • Version: 10.15.4

IntelliJ Idea:

  • Version: Ultimate 2019.3

Erlang:

  • Installer: homebrew
  • Version: 22

Elixir:

  • Installer: homebrew
  • Version: 1.10.2

Plugin:

  • Version: 11.6.0

Additional context
Add any other context about the problem here.

@KronicDeth
Copy link
Owner

I'm guessing since it is passing through ExUnit.Diff.container_to_algebra that I missed an update to the requirements for ExUnit.Formatters that they need to be able to transform the diff algebra and not assume the input is just an iolist.

@KronicDeth KronicDeth changed the title ExUnit test output formatter crashes for failing tests team_city_ex_unit_formatting.ex does not handle ExUnit.Diff.container_to_algebra/5 output Apr 24, 2020
@KronicDeth KronicDeth added this to the 11.6.1 milestone Apr 24, 2020
@KronicDeth KronicDeth self-assigned this Apr 24, 2020
@KronicDeth
Copy link
Owner

Looks like elixir-lang/elixir@98c6bba contains the changes to the cli_formatter that I need to port to support the pattern diffing added in Elixir 1.10.

@KronicDeth
Copy link
Owner

This test from elixir-lang/elixir@98c6bba can be used to reproduce the bug:

defmodule MyAppTest do
  use ExUnit.Case
 
  test "the truth" do
    assert ["Tvo", 1 | [:ok , {}]] = ["Two", :ok, self(), {true}]
  end
end

@KronicDeth
Copy link
Owner

Screen Shot 2020-04-24 at 10 14 21 AM

Porting the changes worked

@col
Copy link
Author

col commented May 2, 2020

Awesome. Thank you @KronicDeth !

@khoinv
Copy link

khoinv commented May 29, 2021

I faced it again after updating some parts.
My env is

  • Intellij 2021.1.1 and
  • elixir 1.9.4
  • erlang 21.1
  • elixir plugin: 11.10.0
  • erlang plugin: 0.11.1108

My test is:

      assert 0 == 1

Thanks!

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

Successfully merging a pull request may close this issue.

3 participants