Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
karma-firefox-launcher
Advanced tools
The karma-firefox-launcher is a plugin for the Karma test runner that allows you to run your tests in the Firefox browser. It provides seamless integration with Karma, enabling automated testing in Firefox as part of your continuous integration pipeline.
Launching Firefox for Testing
This configuration file for Karma sets up the test runner to use the Firefox browser. It specifies the use of the Jasmine framework and includes the necessary plugins for both Jasmine and the Firefox launcher.
module.exports = function(config) {
config.set({
browsers: ['Firefox'],
frameworks: ['jasmine'],
files: [
'test/**/*.spec.js'
],
plugins: [
'karma-jasmine',
'karma-firefox-launcher'
]
});
};
Customizing Firefox Launch Options
This configuration demonstrates how to set up a custom launcher for Firefox in headless mode. This is useful for running tests in environments where you don't have a display, such as in a CI/CD pipeline.
module.exports = function(config) {
config.set({
browsers: ['Firefox'],
customLaunchers: {
FirefoxHeadless: {
base: 'Firefox',
flags: ['-headless']
}
},
frameworks: ['jasmine'],
files: [
'test/**/*.spec.js'
],
plugins: [
'karma-jasmine',
'karma-firefox-launcher'
]
});
};
The karma-chrome-launcher is a plugin for the Karma test runner that allows you to run your tests in the Chrome browser. Similar to karma-firefox-launcher, it provides seamless integration with Karma and supports both regular and headless modes for Chrome.
The karma-safari-launcher is a plugin for the Karma test runner that allows you to run your tests in the Safari browser. It offers similar functionality to karma-firefox-launcher but is tailored for the Safari browser, making it useful for testing on macOS environments.
The karma-edge-launcher is a plugin for the Karma test runner that allows you to run your tests in the Microsoft Edge browser. Like karma-firefox-launcher, it integrates with Karma to facilitate automated testing in Edge, supporting both legacy and Chromium-based versions of the browser.
Launcher for Mozilla Firefox.
karma-firefox-launcher
is deprecated and is not accepting new features or general bug fixes.See deprecation notice for karma
.
Web Test Runner,
jasmine-browser-runner
,
and playwright-test
provide
browser-based unit testing solutions which can be used as a direct alternative.
The easiest way is to keep karma-firefox-launcher
as a devDependency in your package.json
.
You can simple do it by:
npm install karma-firefox-launcher --save-dev
// karma.conf.js
module.exports = function (config) {
config.set({
plugins: [require("karma-firefox-launcher")],
browsers: [
"Firefox",
"FirefoxDeveloper",
"FirefoxAurora",
"FirefoxNightly",
],
});
};
You can pass list of browsers as a CLI argument too:
karma start --browsers Firefox,Chrome
To run Firefox in headless mode, append Headless
to the version name, e.g. FirefoxHeadless
, FirefoxNightlyHeadless
.
You can specify the location of the Firefox executable using the following environment variables:
FIREFOX_BIN
(for browser Firefox
or FirefoxHeadless
)FIREFOX_DEVELOPER_BIN
(for browser FirefoxDeveloper
or
FirefoxDeveloperHeadless
)FIREFOX_AURORA_BIN
(for browser FirefoxAurora
or FirefoxAuroraHeadless
)FIREFOX_NIGHTLY_BIN
(for browser FirefoxNightly
or
FirefoxNightlyHeadless
)In addition to Environment variables you can specify location of the Firefox executable in a custom launcher:
browsers: ['Firefox68', 'Firefox78'],
customLaunchers: {
Firefox68: {
base: 'Firefox',
name: 'Firefox68',
command: '<path to FF68>/firefox.exe'
},
Firefox78: {
base: 'Firefox',
name: 'Firefox78',
command: '<path to FF78>/firefox.exe'
}
}
To configure preferences for the Firefox instance that is loaded, you can specify a custom launcher in your Karma
config with the preferences under the prefs
key:
browsers: ['FirefoxAutoAllowGUM'],
customLaunchers: {
FirefoxAutoAllowGUM: {
base: 'Firefox',
prefs: {
'media.navigator.permission.disabled': true
}
}
}
If you have extensions that you want loaded into the browser on startup, you can specify the full path to each
extension in the extensions
key:
browsers: ['FirefoxWithMyExtension'],
customLaunchers: {
FirefoxWithMyExtension: {
base: 'Firefox',
extensions: [
path.resolve(__dirname, 'helpers/extensions/myCustomExt@suchandsuch.xpi'),
path.resolve(__dirname, 'helpers/extensions/myOtherExt@soandso.xpi')
]
}
}
Please note: the extension name must exactly match the 'id' of the extension. You can discover the 'id' of your
extension by extracting the .xpi (i.e. unzip XXX.xpi
) and opening the install.RDF file with a text editor, then look
for the em:id
tag under the Description
tag. If your extension manifest looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>myCustomExt@suchandsuch</em:id>
<em:version>1.0</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<em:unpack>false</em:unpack>
[...]
</Description>
</RDF>
Then you should name your extension myCustomExt@suchandsuch.xpi
.
For more information on Karma see the homepage.
FAQs
A Karma plugin. Launcher for Firefox.
The npm package karma-firefox-launcher receives a total of 267,692 weekly downloads. As such, karma-firefox-launcher popularity was classified as popular.
We found that karma-firefox-launcher demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.