Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to properly import Absinthe assertions #22

Open
tadiou opened this issue Mar 25, 2021 · 5 comments · May be fixed by #27
Open

Can't seem to properly import Absinthe assertions #22

tadiou opened this issue Mar 25, 2021 · 5 comments · May be fixed by #27

Comments

@tadiou
Copy link

tadiou commented Mar 25, 2021

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

@mackshkatz
Copy link

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?

@jimshepherd
Copy link

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

@mackshkatz
Copy link

@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!

@randycoulman randycoulman linked a pull request Nov 28, 2021 that will close this issue
@shaunr0b
Copy link

shaunr0b commented Sep 7, 2022

Ran into this issue

this command fixed it:

MIX_ENV=test mix deps.compile --force assertions

@rizasal
Copy link

rizasal commented Oct 21, 2022

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants