Debug Browser Javascript Tests
Learn how to set up logging out to the Node.js console, what's getting logged in the browser console, and how to start a debugging session with Jasmine using the browser developer tools.
Using ‘console.log’
At the time of writing of this course, using jasmine-browser-runner runSpecs
doesn’t output the instances of console.log
to the terminal (the Node.js process) because the tests execute in the browser environment. We can see these logs in the browser’s console part of the developer tools. If that browser is headless, then there’s no chance to see the logs.
There is a way to set up a reporter for the jasmine-browser-runner so that the logs show on the terminal. It’s based on this Jasmine issue response.
See the spec/helpers/logs.js
in the code ...
Access this course and 1400+ top-rated courses and projects.