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
npx skills add LambdaTest/agent-skills --skill karma-skill -a claude-codeWhat 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.jsfor Jasmine tests with coverage output incoverage/ - 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-code2Manually: put the files in place
~/.claude/skills/karma-skill/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/karma-skill/
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill karma-skill -a codex2Manually: put the files in place
.agents/skills/karma-skill/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill karma-skill -a cursor2Manually: put the files in place
.cursor/skills/karma-skill/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install LambdaTest/agent-skills karma-skill2Manually: put the files in place
.github/skills/karma-skill/SKILL.md1Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill karma-skill -a gemini-cli2Platform CLI
gemini skills install https://github.com/LambdaTest/agent-skills --path karma-skillManually: put the files in place
.devin/skills/karma-skill/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add LambdaTest/agent-skills --skill karma-skill -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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