A Flatiron student asked me for help the other day on how to change her Karma testing browser in Angular from Chrome to Firefox.
She specifically focused on switching from Chrome to Firefox, but these instructions can be modified to add browser types instead, or replaced with different browsers. Just do a Google search for ‘karma
Here are the steps:
-
Go to
package.jsonand change thekarma-chrome-launcherpackage tokarma-firefox-launcher- As of the writing of this blog post, the current version is^1.1.0. -
Re-run
npm installto unintall the previous launcher and install the new one. -
In
karma.conf.jsin the:pluginskey, replacerequire("karma-chrome-launcher")withrequire("karma-firefox-launcher")in the plugins array. -
Still in
karma.conf.js, go to the:browserskey, and replaceChromewithFirefoxin the browsers array.
Then, run karma start and your tests should work in the proper browser!