Skip to content

Can't seem to properly import Absinthe assertions #22

Open

Description

@itsdanferrellnow

Hey, love the work thank you.

But I'm struggling here with consistently getting the assertions methods to properly compile here.

I have a really (really) small phoenix app i whipped up, where I try to add the Assertions.AbsintheCase to the DataCase, and

I try to write a really simple case here

defmodule AssertionsTestWeb.Schema.Queries.UserTest do
  use AssertionsTest.DataCase

  test "resolves correctly" do
    """
    query {
      user {
        #{document_for(:user)}
      }
    }
    """
    |> assert_response_matches do
      %{
        "user" => %{
          "id" => _id
        }
      }
    end
  end
end

and the DataCase.ex looks like

defmodule AssertionsTest.DataCase do
  use ExUnit.CaseTemplate
  using do
    quote do
      alias AssertionsTest.Repo

      import Ecto
      import Ecto.Changeset
      import Ecto.Query
      import AssertionsTest.DataCase

      use Assertions.AbsintheCase, async: true, schema: AssertionsTestWeb.Schema
    end
  end
  # [....]
end

And it can't find assert_response_matches/4.

== Compilation error in file test/assertions_test_web/gql/queries/user_test.exs ==
** (CompileError) test/assertions_test_web/gql/queries/user_test.exs:2: undefined function assert_response_equals/4
    (elixir 1.11.3) src/elixir_locals.erl:114: anonymous fn/3 in :elixir_locals.ensure_no_undefined_local/3
    (stdlib 3.14) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir 1.11.3) lib/kernel/parallel_compiler.ex:416: Kernel.ParallelCompiler.require_file/2
    (elixir 1.11.3) lib/kernel/parallel_compiler.ex:316: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

Activity

  1. mackshkatz commented on Aug 27, 2021

    @mackshkatz

    I am seeing this same issue. The strange thing is that it works fine for one of my teammates and myself, but not for our other teammate. Also, the compilation fails on our CI build (in Circle). All 3 of us and our CI instance are running elixir 1.12.1

    @devonestes Any thoughts?

  2. jimshepherd commented on Sep 5, 2021

    @jimshepherd

    timgremore's pull request, #24, solved the issue for me.
    Thanks @timgremore!

  3. mackshkatz commented on Sep 5, 2021

    @mackshkatz

    @jimshepherd I should have posted a follow up, but we used PR #24 as well and it fixed the issue for us as well, thanks!

  4. shaunr0b commented on Sep 7, 2022

    @shaunr0b

    Ran into this issue

    this command fixed it:

    MIX_ENV=test mix deps.compile --force assertions

  5. rizasal commented on Oct 21, 2022

    @rizasal

    This issue still exists and is causing builds to fail.
    Any update here?
    @devonestes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions