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

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New

We're in Beta

About us Mission Statement