Is there a way to suppress "no route to path" warnings in `test`?

I have a unit test to validates our custom error pages (404 pages, etc.)

In test, when executing, I get lots of:

..warning: no route path for BossSiteWeb.Router matches "/404_error_test"
  test/boss_site_web/controllers/error_html_test.exs:7: BossSiteWeb.ErrorHTMLTest."test renders 404 not found template"/1

The tests are intentionally calling paths with no route (to generate errors, and validate that the 404 page shows up). Is there any way to suppress these warnings when in mix test?

I could just render the page, but that doesn’t actually test that the fallback error handler is working correctly… so, meh…

Just don’t use the ~p sigil and you won’t get that warning. There’s no use in using it if you know the route doesn’t exist.

1 Like