binarypaladin
To pry or not to pry
When I am not touching front-end code, I pretty much live in the testing environment when doing development. I almost never drop into to dev at all. I find that since dev requires setting up state, why not just have a test case ready that has it and drop in using pry?
So, the start of my debugging often begins with:
iex -S mix test --trace /path/to/test:100
Or, since someone introduced me to dbg it’s turned into:
iex --dbg pry -S mix test --trace /path/to/test:100
I’m in the process of refining some little QoL things and one of the kinda annoying things in this flow is that an iex shell opens even in the absence of IEx.pry() or dbg(). It’s not the worst thing in world as a quick ctrl + c x2 gets me out of there. Still, is there a way to use the same command to only pop the iex session if I include some kind of pry?
The nice thing about this is that I always just use one command to figure off my single tests.
Is there a way to accomplish this?
Most Liked
binarypaladin
So… completely by accident, I noticed something changed with tests—I’m guessing in 1.16, although it might have been 1.15. This happened while messing with terminal aliases.
At some point, definitely in 1.14, in order to get IEX.pry to work in a tests I’d have to do this:
iex -S mix test /path/to/test.exs
That is no longer required.
This:
mix test /path/to/test.exs
Will open up an iex terminal with pry if IEX.pry() is in the code. Otherwise, it will ignore it and not just open an iex terminal at the end. This was the functionality I was looking for in this post anyway.







