when a string equality assertion fails in an ExUnit test case, a color-formatted output is provided. Eg., for:
test "my test" do
assert "xyz" == "xwz"
end
we get
But when I do it inside of expect/4:
test "my test" do
expect(MyMock, :post, fn data ->
assert "xyz" == "xwz"
end)
end
no formatting is done, though:
Any idea if if there's a way to get the same formatting done inside of expect?
PS: What I really want is a way to get a nice string diff when I compare two long strings. Any alternatives are welcome.
PS2: Using mox 1.0.2 on OSX


If you are doing string comparisons on errors, I would suggest you avoid ANSI color codes altogether because they add a lot of "noise" to the output. ANSI color codes are optional anyhow because they are not supported on every system.
In your
config/text.exs(or in which-ever environment you need to work with), add the following to disable the ANSI formatting:See the corresponding docs for IO.ANSI.enabled?/0