Elixir Wallaby uncaught JavaScript error

If you see this error, you may likely have a JS error that has crept in to your JS build you did not realize:

** (Wallaby.JSError) There was an uncaught JavaScript error:

My full error ended up resolving to an app.js file, which took me a second to realize had some new code on a pre-login page. This ended up explaining why the login tests were failing when the login form was loaded (who would have thought?).

The generic nature of the js file (app.js) made it so I did not initially recognize some local code was calling a function on a non-existent element from a DOM query, which was resolving to undefined (so the classList property being referenced was failing).

 ** (Wallaby.JSError) There was an uncaught JavaScript error:
     
webpack:///./js/app.js? 115:22 Uncaught TypeError: Cannot read property 'classList' of null

I have found that issues like this will likely have more to do with local code. The default logger settings are somewhat helpful, and the stack trace eventually resolved to (wallaby 0.28.0) lib/wallaby/chrome/logger.ex:8: Wallaby.Chrome.Logger.parse_log/1.

It took me a minute to realize the app.js here was our local webpack build, not some internal Wallaby build of some sort. If Wallaby is truly the issue, you can try and update dependencies, and I would note you would something more similar to a Chromedriver session id error, as with https://n8williams.com/devblog/general_dev/elixir-wallaby-and-chromedriver-issue-runtimeerror-invalid-session-id.

To this point I have been very pleased with Wallaby, I cannot recommend it enough for acceptance testing, etc!

Leave a Reply

Your email address will not be published. Required fields are marked *