Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
karma-jasmine-html-reporter
Advanced tools
A Karma plugin. Dynamically displays tests results at debug.html page
The karma-jasmine-html-reporter npm package is a plugin for the Karma test runner that provides a visual HTML report of the results of Jasmine tests. It allows developers to see their test results in a more readable and user-friendly format directly in the browser.
Visual HTML Test Results
This feature allows you to see your Jasmine test results in a formatted HTML output. The code sample shows how to configure Karma to use the karma-jasmine-html-reporter by adding 'kjhtml' to the list of reporters and including the plugin in the Karma configuration.
module.exports = function(config) {
config.set({
reporters: ['progress', 'kjhtml'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter')
]
});
};
Debugging Support
The reporter supports interactive debugging by leaving the Jasmine Spec Runner output visible in the browser. The 'clearContext' option is set to false to keep the HTML output visible, allowing developers to inspect and debug directly.
module.exports = function(config) {
config.set({
reporters: ['kjhtml'],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
}
});
};
This package is similar to karma-jasmine-html-reporter but is designed to work with the Mocha testing framework. It provides a more flexible output by allowing different report styles and color schemes.
Karma-spec-reporter outputs test results to the console in a spec format. It is less visual than karma-jasmine-html-reporter as it does not produce an HTML report, but it is useful for a quick overview of test results in the terminal.
This reporter generates a summary of test results in the console after all tests have run. It is simpler than karma-jasmine-html-reporter and does not provide an HTML interface, focusing instead on a concise summary.
Reporter that dynamically shows tests results at debug.html page.
You can also run a describe block, or a single test.
You can simply install karma-jasmine-html-reporter
as a devDependency by:
npm install karma-jasmine-html-reporter --save-dev
// karma.conf.js
module.exports = function(config) {
config.set({
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
require('karma-jasmine-html-reporter')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
}
},
reporters: ['kjhtml']
});
};
In combination with multiple reporters you may want to disable terminal messages because it's already handled by another reporter.
Example using the 'karma-mocha-reporter' plugin:
// karma.conf.js
module.exports = function(config) {
config.set({
// Combine multiple reporters
reporters: ['kjhtml', 'mocha'],
jasmineHtmlReporter: {
suppressAll: true, // Suppress all messages (overrides other suppress settings)
suppressFailed: true // Suppress failed messages
}
});
};
You can pass a list of reporters as a CLI argument too:
karma start --reporters kjhtml
jasmine Version | karma-jasmine-html-reporter version |
---|---|
2.x | 0.2.2 |
3.x | 1.x |
4.x | 2.x |
FAQs
A Karma plugin. Dynamically displays tests results at debug.html page
The npm package karma-jasmine-html-reporter receives a total of 1,532,689 weekly downloads. As such, karma-jasmine-html-reporter popularity was classified as popular.
We found that karma-jasmine-html-reporter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.