Testing exclusively in Chrome misses Firefox-specific rendering and API behavior. This lesson covers karma-firefox-launcher, the standard way to add Firefox and FirefoxHeadless to a Karma suite.
Installing and Using karma-firefox-launcher
karma-firefox-launcher mirrors the Chrome launcher's API closely, providing Firefox (visible window), FirefoxHeadless (no window), and FirefoxDeveloper (Firefox Developer Edition, if installed) launcher configurations.
Listing both browsers runs the full suite twice, once per engine, and reports results separately for each.
Common Firefox Launcher Names
Firefox // visible window
FirefoxHeadless // no window, standard for CI
FirefoxDeveloper // Firefox Developer Edition, if installed
FirefoxHeadless requires a reasonably modern Firefox version with native headless support.
Karma looks for Firefox in standard install locations automatically before falling back to FIREFOX_BIN.
Firefox and Chrome occasionally diverge on timing-sensitive or CSS-dependent test assertions — that divergence is often the entire point of testing both.
Firefox's process startup is sometimes slower than Chrome's; account for this in shared timeout settings.
Firefox Launcher Cheat Sheet
Configuration snippets for common Firefox launcher needs.
Need
Configuration
Basic headless run
browsers: ['FirefoxHeadless']
Point at a custom binary
process.env.FIREFOX_BIN = '/path/to/firefox'
Cross-browser run
browsers: ['ChromeHeadless', 'FirefoxHeadless']
Firefox profile preferences
customLaunchers with a prefs object
Custom Firefox Preferences via customLaunchers
karma-firefox-launcher supports a prefs object on custom launcher configurations, letting you tweak Firefox profile preferences — for example, disabling animations that can otherwise interfere with timing-sensitive UI tests.
Just like Chrome, when Firefox isn't installed in a location the launcher checks automatically (common on minimal Linux CI images), setting FIREFOX_BIN explicitly resolves the launch failure.
FIREFOX_BIN is the standard fix when Firefox isn't found in an expected install location.
Custom launcher prefs objects let you tune Firefox profile settings without a full custom plugin.
Pro Tip
If you only have bandwidth to test in two browsers, ChromeHeadless plus FirefoxHeadless gives the best coverage-to-effort ratio for most web applications, since they use genuinely different rendering and JavaScript engines.
You now understand the Firefox launcher. Next, go deeper on ChromeHeadless specifically — the default choice for most CI pipelines.