UPDATE: getting rid of async: true
seems to fix this, though I’m not sure I understand why it should — shouldn’t migrations finish running before the tests regardless of if they’re running asynchronously or not?
I recently added phx_gen_auth
(version 0.2.0) code to my Phoenix 1.5 app and many of the tests in the user_auth_test.exs
fail when I run my full test suite, outputting ** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "users" does not exist
when they hit the unsafe_validate_unique
validation. If I comment out that validation, I get similar errors, just at different points in the code. But I only see them happen for tests in user_auth_test.exs
, not in any other parts of the test suite that also depend on the users table existing.
The other weird thing is that these errors disappear when I run only the user_auth_test.exs
file’s tests instead of the full test suite. No idea what’s going on. Has anyone seen this before?