elixir icon indicating copy to clipboard operation
elixir copied to clipboard

adds test_pid field in the test metadata

Open ityonemo opened this issue 1 year ago • 1 comments

this enhancement adds a test_pid field into the test context metadata. This is useful for backtracking which test is responsible when a ecto sandbox or mox allowance has triggered after the parent test has finished. For now, one will have to write a custom ExUnit.Formatter to take advantage of this extra metadata.

ityonemo avatar Oct 05 '24 22:10 ityonemo

@ityonemo ping in case it fell through the cracks. :)

josevalim avatar Oct 16 '24 18:10 josevalim

@ityonemo I've added a test case at https://github.com/ityonemo/elixir/pull/1

I'd love for this to go through so I can use it to print out richer information about sandbox/allowance failures from a custom ex_unit formatter!

axelson avatar Nov 07 '24 17:11 axelson

Thank you @axelson! Looking at the test you added, I think it would be much simpler to test_pid at the beginning, simpler to use and to test too, so I pushed this change. Thank you both!

josevalim avatar Nov 07 '24 20:11 josevalim

Nice! Thank you José!

axelson avatar Nov 08 '24 16:11 axelson