Problem: You want to assure your web app isn’t logging messages to the...


Problem: You want to assure your web app isn’t logging messages to the console, and enforce it on CI.

Solution: Use Playwright.

With these 3 lines, I can fail a test if anything is written to the console. I can also be more specific and only fail if a console error occurs.

To make this easy to apply to every test, I created my own page goto function that also applies this console config.

View original on X