Skip to main content
skill CX Codex

karma-skill — Claude Code skill: Karma config, browser test runs

Builds karma.conf.js for browser-based JavaScript tests on Jasmine, Mocha or QUnit, and shows how to run the suite.

MIT 226 installs ★ 393 updated 2026-10-13

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add LambdaTest/agent-skills --skill karma-skill -a claude-code
Open on GitHub

What karma-skill does

The skill writes karma.conf.js for browser tests in JavaScript and TypeScript. It fills in frameworks, file globs, a coverage preprocessor, reporters and browser launchers; the sample config runs Jasmine against Chrome and Firefox on port 9876. Angular projects get @angular-devkit/build-angular as a framework plus the matching plugins.

Package commands are listed as well: npm install karma karma-jasmine karma-chrome-launcher karma-coverage --save-dev, then npx karma init karma.conf.js to scaffold, then npx karma start --single-run for a single pass. A separate block covers LambdaTest cloud browsers, where a ChromeLT launcher reaches hub.lambdatest.com over WebDriver. Credentials come from LT_USERNAME and LT_ACCESS_KEY in the environment, so a cloud run stops there without them.

Deeper templates sit in reference/playbook.md — coverage thresholds and CI launchers, service mocks, HttpTestingController cases, directive and pipe tests, switchMap cancellation, MockStore, GitHub Actions, plus a table of frequent failures with causes and fixes.

What it helps with

  • scaffold a Karma config for Jasmine or Mocha
  • wire HTML coverage output into the test run
  • point Karma at LambdaTest cloud browsers
  • set up Karma for an Angular workspace
  • trace a browser test that keeps failing

Example prompts for the agent

  • Write a karma.conf.js for Jasmine tests with coverage output in coverage/
  • Switch the Karma run to LambdaTest cloud browsers, keys come from the environment
  • Set up Karma for Angular with @angular-devkit/build-angular

How to install karma-skill

1Skills CLI (Vercel)

npx skills add LambdaTest/agent-skills --skill karma-skill -a claude-code

2Manually: put the files in place

~/.claude/skills/karma-skill/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/karma-skill/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about karma-skill

How do I install karma-skill in Claude Code?

Run npx skills add LambdaTest/agent-skills --skill karma-skill -a claude-code. The skill lands in ~/.claude/skills/karma-skill/SKILL.md.

What does karma-skill do?

It generates Karma configuration for browser-based JS tests: frameworks, file lists, coverage, launchers. It also supplies the install, init and run commands.

What does the LambdaTest launcher need?

The ChromeLT launcher reads LT_USERNAME and LT_ACCESS_KEY from the environment. Without those variables it cannot authenticate against hub.lambdatest.com.

Source text

SKILL.md · MIT
---
name: karma-skill
description: >
  Generates Karma test runner configurations for browser-based JavaScript testing.
  Works with Jasmine, Mocha, or QUnit. Use when user mentions "Karma",
  "karma.conf.js", "browser test runner". Triggers on: "Karma", "karma.conf",
  "karma test runner", "browser-based JS test".
languages:
  - JavaScript
  - TypeScript
category: unit-testing
license: MIT
metadata:
  author: TestMu AI
  version: "1.0"
---

# Karma Testing Skill

## Core Patterns

### karma.conf.js

```javascript
module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine'],
    files: [
      'src/**/*.js',
      'test/**/*.spec.js'
    ],
    preprocessors: {
      'src/**/*.js': ['coverage']
    },
    reporters: ['progress', 'coverage'],
    coverageReporter: {
      type: 'html',
      dir: 'coverage/'
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome', 'Firefox'],
    singleRun: false,
    concurrency: Infinity,

    // LambdaTest cloud browsers
    customLaunchers: {
      ChromeLT: {
        base: 'WebDriver',
        config: {
          hostname: 'hub.lambdatest.com',
          port: 80
        },
        browserName: 'Chrome',
        version: 'latest',
        name: 'Karma Test',
        tunnel: true,
        user: process.env.LT_USERNAME,
        accessKey: process.env.LT_ACCESS_KEY
      }
    }
  });
};
```

### Test with Jasmine Framework

```javascript
describe('StringUtils', () => {
  it('should capitalize first letter', () => {
    expect(StringUtils.capitalize('hello')).toBe('Hello');
  });

  it('should handle empty string', () => {
    expect(StringUtils.capitalize('')).toBe('');
  });
});
```

### Angular Integration

```javascript
// karma.conf.js for Angular
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
  require('karma-jasmine'),
  require('karma-chrome-launcher'),
  require('karma-coverage'),
  require('@angular-devkit/build-angular/plugins/karma')
],
```

## Setup: `npm install karma karma-jasmine karma-chrome-launcher karma-coverage --save-dev`
## Run: `npx karma start` or `npx karma start --single-run`
## Init: `npx karma init karma.conf.js`

## Deep Patterns

See `reference/playbook.md` for production-grade patterns:

| Section | What You Get |
|---------|-------------|
| §1 Production Configuration | Full karma.conf.js with coverage thresholds, reporters, CI launchers |
| §2 Component Testing | Service mocking, DOM interaction, form validation patterns |
| §3 HTTP Service Testing | HttpTestingController, error handling, retry testing |
| §4 Directive & Pipe Testing | Host component pattern, custom pipes with edge cases |
| §5 RxJS & Async Patterns | debounceTime, switchMap cancellation, subscription cleanup |
| §6 Router & NgRx Testing | RouterTestingModule, MockStore, selector overrides |
| §7 LambdaTest Integration | Cloud browser configuration for cross-browser testing |
| §8 CI/CD Integration | GitHub Actions with coverage, test reporting |
| §9 Debugging Table | 12 common problems with causes and fixes |
| §10 Best Practices | 14-item checklist for production Angular testing |

© TestMu AI · MIT · LambdaTest/agent-skills

Similar skills

All skills for Testing and QA →

From the same set47

The whole set →
espresso-skill Generate Espresso UI tests for Android apps written in Kotlin or Java. Use the skill to exercise screen interactions and check what the interface displays afterward. CX Codex +1 234installs laravel-dusk-skill Generates E2E tests with Laravel Dusk. The agent writes PHP code with $browser->visit, form checks, and Page Objects. CX Codex +1 231installs test-framework-migration-skill test-framework-migration-skill converts E2E test scripts between Selenium, Playwright, Puppeteer, and Cypress. It rewrites selectors, assertions, and lifecycle methods automatically. CX Codex +1 229installs behave-skill Generate Python BDD tests with Gherkin feature files and Behave step implementations. Useful when you need to turn user flows into runnable scenarios. CX Codex +1 227installs selenide-skill Generates Java UI tests with Selenide, configuring element selectors, fluent conditions, and automatic waits. CX Codex +1 225installs xunit-skill Gives the coding agent a working pattern for xUnit.net in C#: which attribute to use, how to share fixtures, what to assert. Useful when tests need to match xUnit conventions. CX Codex +1 224installs specflow-skill Drafts SpecFlow BDD suites for C#/.NET: Gherkin feature files plus the step bindings behind them. Useful when a project already runs on NUnit or xUnit. CX Codex +1 223installs serenity-bdd-skill serenity-bdd-skill is a Claude Code skill that creates Java BDD tests with Serenity and the Screenplay pattern. It activates for requests about Serenity, @Steps, or Serenity reports. CX Codex +1 223installs

Project sponsors

Companies that keep this analytics open