victorolinasc / junit-formatter

A JUnit XML report exporter for Elixir's ExUnit
https://hexdocs.pm/junit_formatter/
Apache License 2.0
111 stars 37 forks source link

generate_test_body doesn't handle crashing subprocesses #29

Closed dmt closed 6 years ago

dmt commented 6 years ago

We have had occasions where a subprocess in a test crashes and then JUniterFormatter also errors when trying to generate the xml. Which makes it harder to find the underlying error.

     test/formatter_test.exs:86
     ** (exit) exited in: :sys.terminate(#PID<0.300.0>, :normal, :infinity)
         ** (EXIT) an exception was raised:
             ** (ArgumentError) argument error
                 :erlang.atom_to_binary({:EXIT, #PID<0.303.0>}, :utf8)
                 (junit_formatter) lib/formatter.ex:212: JUnitFormatter.generate_test_body/1
                 (junit_formatter) lib/formatter.ex:188: JUnitFormatter.generate_testcases/1
                 (junit_formatter) lib/formatter.ex:168: anonymous fn/2 in JUnitFormatter.generate_testsuite_xml/1
                 (elixir) lib/enum.ex:1826: Enum."-reduce/3-lists^foldl/2-0-"/3
                 (junit_formatter) lib/formatter.ex:167: JUnitFormatter.generate_testsuite_xml/1
                 (elixir) lib/enum.ex:1270: Enum."-map/2-lists^map/1-0-"/2
                 (junit_formatter) lib/formatter.ex:65: JUnitFormatter.handle_cast/2
                 (stdlib) gen_server.erl:616: :gen_server.try_dispatch/4
                 (stdlib) gen_server.erl:686: :gen_server.handle_msg/6
                 (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
dmt commented 6 years ago

Thanks! Can you please also release a new version?

victorolinasc commented 6 years ago

Will do! I'm planning on doing so today or maybe tomorrow (I will try to take a look at some other issues and maybe update docs).

dmt commented 6 years ago

Thanks. No rush.