Io.puts and Logger not working along with errors not being dispayed

Here is my primary test file

ExUnit.start()


Ecto.Adapters.SQL.Sandbox.mode(Core.Repo, :manual)

Faker.start()


defmodule ChatBackendTest do
  use ExUnit.Case, async: true
  alias ChatBackendTest.Support.Factory

  use ChatBackendTest.Support.EctoTemplate


  require Logger
  alias Core.Schema.User


  test "create user" do

    _ = Factory.create(User, %{})

    IO.puts("Should Print this too")
#
  end



end

And here is the factory file

defmodule ChatBackendTest.Support.Factory do
  alias Authentication.Schema.User

  alias Core.Repo

  require Logger

  def create(User, attrs) do
    Logger.error("Should print on console")

    user_data =
      Keyword.merge(
        [
          phone_number: Faker.Phone.PtBr.phone(),
          uuid: Faker.UUID.v4(),
          last_seen: NaiveDateTime.utc_now(),
          registration_id: Faker.UUID.v4()
        ],
        attrs
      )

    try do
      User |> struct(user_data) |> Repo.insert(returning: true)
    rescue
      e ->
        Logger.error("Error: #{inspect(e)}")
    end
  end
end

The problem : Io.puts or any other code is working before i call the factory.create method. However after factory.create nothing is executing , when when i put a IO.puts as the first statemetn inside the create function, nothing was printed. No error was shown in the console either.

However, when i copy the create code and put it directly in the test file. The resuce thing handles the error and gives me some error on struct.

The question being, what’s wrong with elxir not showing errors. How do i make it that all the erros are logged in instead of the test being half executed.