Package detail

karma-summary-reporter

sth38.2kMIT4.0.1

Displays a summary of tested browsers and failed testcases after a test run.

karma-plugin, karma-reporter

readme

karma-summary-reporter

Show a table detailing the test results for all connected browsers at the end of a test run. This gives a better overview which browsers are broken than the output of other reporters.

The plugin is intended to be used in addition to some other reporter that shows you the error details. This plugin only shows an overview of passed and failed testcases, no more detailed information:

screenshot

Use cases

Testing in several browsers

When you test in several browsers, the sequential test output of all the browsers can be unwieldy to quickly grasp the problems in the tests. The summary table provided by this reporter shows the failing tests in a compact format that is easy to grasp at a glance:

screenshot

Here we can clearly see that addPrefix() has some general problem while the error in stripPrefix() seems to be specific to IE.

Feature tests

The summary table is also useful if you want to (ab-)use karma to run feature tests, like checking which standard string functions are available:

screenshot

We can see that IE is lacking some features here.

Installation

With npm:

npm install --save-dev karma-summary-reporter

With yarn:

yarn add --dev karma-summary-reporter

Config

module.exports = function(config) {
   config.set({
      reporters: ['progress', 'summary'],
      summaryReporter: {
         // 'failed', 'skipped' or 'all'
         show: 'failed',
         // Limit the spec label to this length
         specLength: 50,
         // Show an 'all' column as a summary
         overviewColumn: true,
         // Show a list of test clients, 'always', 'never' or 'ifneeded'
         browserList: 'always',
         // Use custom symbols to indicate success and failure
         symbols: {success: 'o', failure: 'x'}
      }
   });
};

This configures Karma to run this summary reporter in addition to the Karma default progress reporter.

show

Select which tests are displayed in the summary. There are three choices:

  • 'failed': Only show tests that failed in some browser (default)
  • 'skipped': Additionally show tests that got skipped in some browser
  • 'all': Show all test, also ones that didn't fail

specLength

Space reserved to display the spec label (width of the first column in the results table).

overviewColumn

Shows a overview column in the results table, showing the total result of a test over all browsers ("failed" if the test failed anywhere, ...). In the above examples this is the column with the "all" header. Setting this option to false disables this column.

browserList

Show the list of connected browsers before the result table

  • 'always': Show always (default)
  • 'never': Show never
  • 'ifneeded': Show only if there are test results shown from multiple browsers

symbols

Customize the symbols used to show successful or failed tests. In some fonts the default symbols might not look optimal, so different ones can be configured. For example, to use pure ASCII symbols:

symbols: {
   success: 'o',
   failure: 'x'
}

symbols.success is used for successful test cases, symbols.failure for failed test cases.

It is expected that each of those symbols displays as a single character, otherwise the output might not line up correctly.

Test failure details

This reporter just shows a summary of failed test cases once testing is complete, it doesn't show stack traces or other useful information about the failures.

To display these details, add an additional reporter to your karma.conf.js that shows all the additional information you want to see. For example, to run the summary reporter in addition to the spec reporter you'd have this configuration:

reporters: ['spec', 'summary']

Or with karma-mocha-reporter your config could look like this:

reporters: ['mocha', 'summary'],
mochaReporter: { output: 'minimal' }

Karma's default reporter is called progress, so if you just want to extend that it would look like this:

reporters: ['progress', 'summary']

changelog

Changelog

v4.0.1, 2024-01-07 (compare to v4.0.0)

  • Improvement: Re-publish from correct branch

v4.0.0, 2024-01-07 (compare to v3.1.1)

  • Improvement (Breaking change): Remove testing for old Node versions 12, 14, 19 (#33) (Now only tested for node >= v16) (fb672f3)
  • Improvement (Breaking change): Upgrade dependencies (Now requires node >= v14) (3e52b0d and others)
  • Improvement: Add testing for new Node versions 20, 21 (#33) (fb672f3)
  • Bugfix: Report tests separately even if their descriptions match (#31) (5e4efdc)
  • Improvement (dev): Add yarn caching in Github action (0f119ff)
  • Improvement (dev): Add CodeQL Analysis (267f9f0)

v3.1.1, 2022-02-17 (compare to v3.1.0)

  • Documentation: Update changelog

v3.1.0, 2022-02-17 (compare to v3.0.0)

v3.0.0, 2021-09-14 (compare to v2.0.3)

  • Improvement (Breaking change): Upgrade dependencies (Now requires node >= v12)

v2.0.3, 2021-09-14 (compare to v2.0.2)

  • Improvement: Upgrade dependencies
  • Improvement: Add testing for node v16 (854af3e)

v2.0.2, 2021-03-17 (compare to v2.0.1)

  • Improvement: Remove unused files from packaged code

v2.0.1, 2021-03-17 (compare to v2.0.0)

  • Improvement: Update dev dependencies
  • Compatibility: Add node v15 to CI testing
  • Documentation: Improve changelog

v2.0.0, 2021-01-14 (compare to v1.10.1)

  • Compatibility (Breaking change): Update chalk to ^4.0.0 (Now requires node >= v10)
  • Compatibility: Remove peerDependencies for karma <= v4
  • Improvement: Update dev dependencies (Now requires node >= v10.12.0)

v1.10.1, 2021-01-13 (compare to v1.10.0)

  • Documentation: Update changelog (ddff0cd)

v1.10.0, 2021-01-13 (compare to v1.9.0)

  • Feature: Add a browserList config option (6cd3506)
  • Compatibility: Add support for karma v6 (4255b9a)

v1.9.0, 2020-10-09 (compare to v1.8.0)

  • Improvement: Remove browser messages that lead to duplicate output when combined with other reporters (#15)
  • Improvement (dev): Dev dependency upgrades (including security fixes)
  • Compatibility: Remove CI testing for node v6
  • Compatibility: Add CI testing for node v14
  • Compatibility: Add CI testing on windows, macos

v1.8.0, 2020-04-16 (compare to v1.7.2)

  • Feature: Compatibility with karma v5
  • Improvement: Improved changelog format
  • Improvement (dev): Dev dependency upgrades (including security fixes)

v1.7.2, 2020-02-14 (compare to v1.7.1)

  • Bugfix: Error messages not related to a specific test run were not handled correctly, losing these error messages and triggering further problems inside Karma (#11)

v1.7.1, 2019-09-11 (compare to v1.7.0)

  • Improvement: Include updated changelog

v1.7.0, 2019-09-11 (compare to v1.6.0)

  • Feature: Support mocha 6.x
  • Improvement: Add changelog
  • Improvement: Upgrade dependencies

v1.6.0, 2019-02-12 (compare to v1.5.2)

v1.5.2, 2018-12-05 (changes to v1.5.1)

v1.5.1, 2018-08-28 (compare to v1.5.0)

v1.5.0, 2018-01-19 (compare to v1.4.0)

v1.4.0, 2017-10-23