Skip to content

Karma Cheat Sheet

This page collects the most important Karma configuration options, launchers, reporters, and CLI flags from across the entire course into one quick-reference cheat sheet.

How to Use This Cheat Sheet

Each table below focuses on one area of Karma: core config.set() options, launchers, reporters, coverage settings, and CLI flags. Bookmark this page and use it as a lookup reference while editing karma.conf.js, rather than re-reading full lessons for a syntax reminder.

module.exports = function(config) {
  config.set({
    frameworks: ['jasmine'],
    files: ['src/**/*.spec.js'],
    browsers: ['ChromeHeadless'],
    singleRun: true
  });
};

The core shape nearly every karma.conf.js file is built around.

Core config.set() Options

basePath, frameworks, files, exclude, preprocessors
reporters, port, colors, logLevel
browsers, customLaunchers, concurrency
autoWatch, singleRun, client
plugins, coverageReporter
  • Use this section as the fastest reminder of every top-level config key covered in this course.
  • Full launcher and reporter tables follow below, organized by category.
  • Coverage-specific settings and CLI flags are further down this page.
  • Every option here has a dedicated lesson earlier in the course if you need the full explanation.

Launchers Reference

Every launcher package and the browser names it provides.

Package Provides
karma-chrome-launcher Chrome, ChromeHeadless, ChromeCanary, Edge
karma-firefox-launcher Firefox, FirefoxHeadless, FirefoxDeveloper
karma-safari-launcher Safari (macOS only)
karma-ie-launcher IE (legacy, Windows only)
customLaunchers Your own named, extended configurations

Reporters Reference

Every reporter covered in this course and what it's best used for.

Reporter Package Best For
progress built-in Default, minimal terminal output
dots built-in Extremely compact terminal output
spec karma-spec-reporter Readable, per-spec output
junit karma-junit-reporter CI dashboards parsing XML
html karma-htmlfile-reporter Shareable, browsable reports
coverage karma-coverage Code coverage summaries

Coverage and CLI Reference

Quick lookups for coverage configuration and the most-used CLI flags.

Category Reference
Coverage preprocessor preprocessors: { 'src/**/!(*.spec).js': ['coverage'] }
Coverage formats coverageReporter.reporters: [{ type: 'html' }, { type: 'lcovonly' }]
Coverage thresholds coverageReporter.check.global.statements (and branches/functions/lines)
Run once (CI) karma start --single-run
Override browsers karma start --browsers ChromeHeadless
Generate a starter config karma init

Common Mistakes

  • Treating this cheat sheet as a substitute for understanding why each option behaves the way it does.
  • Forgetting launcher packages must be installed separately for every browser family referenced.
  • Using a broad coverage glob pattern despite this page's explicit exclusion reminder.
  • Not bookmarking this page for quick lookups during real project configuration work.

Key Takeaways

  • This cheat sheet consolidates config, launcher, reporter, and coverage references in one place.
  • Use it as a lookup tool, not a replacement for understanding the underlying concepts from earlier lessons.
  • Combine it with your project's own karma.conf.js for a complete quick-reference setup.
  • Revisit specific lessons whenever a cheat sheet entry needs a deeper refresher.

Pro Tip

Keep this cheat sheet page open in a browser tab while editing an unfamiliar karma.conf.js for the first time — most developers stop needing it once the core options and launcher/reporter names become familiar.