binarypaladin

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

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.

Where Next?

Popular in Questions Top

New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement