About a month ago I posted about debugging chrome JS and mochitests. Since then, we’ve done a fair bit to improve the situation, and so I figured an update was in order (I’ve posted some of this to fx-dev and m.d.platform already, so apologies if you’re reading this twice). In particular:
- After updating your chrome/remote debugging settings, no restart or new window is required anymore to start debugging, and the notes that say so are gone, too. So all you need to do is toggle the required settings, and open the debugger from the menu.
- As of today’s nightly (still building) you’ll be able to use the
--jsdebugger
flag to start the browser debugger on browser startup. (with many thanks due to Panos for fixing an issue that stopped this, as well as –jsconsole, from working on Nightly builds, but not self-compiled builds) - As of just now, mach on mozilla-central supports using the aforementioned flag with mochitests as well, and you can debug your mochitests in one easy command:
./mach mochitest-browser --jsdebugger <my-test(s)>
The test framework takes care of setting the required prefs in the freshly created profile, – you won’t even be prompted to allow the connection – and will wait with running the tests so you have time to set breakpoints etc.
Happy debugging!
Pingback: Debugging chrome JS and mochitests | Use Tables!
This is great! Thank you to everyone who contributed to this 🙂