In a project I’m working on, I cannot get tests with breakpoints or pry
working. Here is an example in a new mix project.
Create a fresh project:
$ mix new breakpoints_issue
$ cd breakpoints_issue
Try to run tests with breakpoints:
$ iex -S mix test --breakpoints
Erlang/OTP 28 [erts-16.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Compiling 1 file (.ex)
Generated breakpoints_issue app
Running ExUnit with seed: 780637, max_cases: 20
Cannot pry #PID<0.168.0> at test/breakpoints_issue_test.exs:6. Is an IEx shell running?
..
Finished in 0.01 seconds (0.00s async, 0.01s sync)
1 doctest, 1 test, 0 failures
Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
Additionally, regular pry
doesn’t seem to be working either. First, I add a dbg()
call to the autogenerated hello
function:
defmodule BreakpointsIssue do
def hello do
:world |> dbg()
end
end
Then, run iex:
$ iex --dbg pry -S mix
Erlang/OTP 28 [erts-16.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Compiling 1 file (.ex)
Generated breakpoints_issue app
Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> BreakpointsIssue.hello
Cannot pry #PID<0.162.0> at BreakpointsIssue.hello/0 (lib/breakpoints_issue.ex:16). Is an IEx shell running?
:world #=> :world
:world
iex(2)> whereami
Pry session is not currently enabled
```
Still seems not to work.
Am I missing something here?
(I have Elixir installed with asdf
, and OS is MacOS 15.6.1 (arm).)