Actually, it can run on a ‘real’ browser (e.g. Chromium) in ‘headless’ mode as well - one just needs to install
xvfb-run and prepend it to any test command (or better still,
xvfb-run -a to assign a virtual display port automatically).
This approach works for Karma tests. But you may just as well open the test in another tab on your device’s browser if you prefer to see it ‘in action’. You may not notice any useful content though, as the tests usually run very quickly; you would also need to keep that tab open for the duration of your tests. For debugging though (if you want to set breakpoints) I think this is the best way to go (you can print-debug ‘virtual’ sessions, but that can be painful).
It also works for e2e tests - one just needs to take ‘screenshots’. E.g. I can run Protractor tests and use
browser.takeScreenshot() to capture the current state.
EDIT: corrected my earlier suggestion that Protractor can run without Xvfb - which in fact it can’t, at least yet.