You could also set the CHROME_BIN environment variable to chromium
export CHROME_BIN=/usr/bin/chromium-browser
Answer from user1067920 on Stack OverflowView Karma Test Output in a Browser? - Stack Overflow
Is it possible to run Karma with no browsers at all?
angularjs - debug in browser using testacular (now karma) - Stack Overflow
Use Karma testrunner On Google Chrome Extension
AFAIK, the previous two answers are correct in that you'll want to run the tests in a browser; click DEBUG and view the output in the console.
Politely contradicting the previous answer, I regularly do this and step-through debug with full variable interaction using Karma.
The proper answer to your question, because what you want is pretty HTML based output, is "no." However, this plugin for karma may give you the results you desire.
https://npmjs.org/package/karma-html-reporter
You need to run it with singleRun = false in karma.conf.js and then click the button on the top corner that says "DEBUG". Then you should see the output and it won't disappear or close. You will also be able to use the console to debug.
Worth noting that debugging e2e tests isn't that easy because they are "future" based so you won't be able to intercept values (afaik).
I am going to add my two cents to this.
Correct - Karma requires a browser to run. BUT - you can run Chrome in Headless mode, which means although you do need the browser installed, it will not open it's UI, and you can therefore run the tests purely through an SSH session for example.
We used this configuration for our CI/CD deployments. Our Docker image for running the tests had Chrome installed and we ran them with Chrome headless mode. Worked like a charm.
To use this, simply modify your browsers property in your karma.conf.js
browsers: ['ChromeHeadless']
Hope this might help someone out there who may be looking for something similar...
Karma needs a browser to be set.
You can make use of PhantomJS instead of Chrome.
Indeed, it's more discreet than a traditional browser launch.
In
karma.conf.js:browsers = ['Chrome'];In your failing spec:
it('spec', function() { debugger; // This is like setting a breakpoint // ... });- Run Karma.
- Go to the newly opened Chrome Browser, open the console and refresh the page.
Now in Chrome's Developer Tools source tab you should see the execution stopped at the debugger.
Include "browsers = ['Chrome'];" in your karma.config file.
When Chrome opens, you should see "Karma - connected" at the top, with a "Debug" button to the upper-right.
Click this debug button, and a "Karma DEBUG RUNNER" tab will open. Then, simply right-click, inspect element, and debug as you normally would.
matthias-schuetz wrote a plugin that claims to produce html test output.
https://npmjs.org/package/karma-htmlfile-reporter
Along with the instructions on the plugin page I had to include a reference to the plugin in the Karma config -
plugins: [
'karma-htmlfile-reporter'
]
Accroding to Documention, even not very perfect:
If 'singleRun' is false, it will set the ci-mode on, so, make it true, and you will see some failed red status on the top bars of browers.