mcpField
K
karma-skill

karma-skill

github.com/lambdatestTesting & quality384220 installsUpdated 2w ago
Repository

About karma-skill

karma-skill is a reference skill for configuring and running Karma tests, including Jasmine and Angular projects. It covers production configuration, component and service testing, async patterns, and CI workflows.

Key features

  1. 01Karma configuration and run commands
  2. 02Jasmine test patterns
  3. 03Angular component and service testing
  4. 04RxJS and asynchronous test patterns
  5. 05Coverage, CI, and debugging guidance

Use cases

  1. 01Set up a Karma and Jasmine test suite
  2. 02Test Angular components, HTTP services, and directives
  3. 03Check RxJS behavior and async cleanup
  4. 04Configure coverage and CI test reporting

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/lambdatest/agent-skills --skill karma-skill

After installing, type/karma-skillin Claude Code to confirm it loaded.

Bundled filesreference/advanced-patterns.mdreference/playbook.md

Details

From the project README

Karma Testing Skill

Core Patterns

karma.conf.js
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
describe('StringUtils', () => {
  it('should capitalize first letter', () => {
    expect(StringUtils.capitalize('hello')).toBe('Hello');
  });

  it('should handle empty string', () => {
    expect(StringUtils.capitalize('')).toBe('');
  });
});
Angular Integration
// 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:

SectionWhat You Get
§1 Production ConfigurationFull karma.conf.js with coverage thresholds, reporters, CI launchers
§2 Component TestingService mocking, DOM interaction, form validation patterns
§3 HTTP Service TestingHttpTestingController, error handling, retry testing
§4 Directive & Pipe TestingHost component pattern, custom pipes with edge cases
§5 RxJS & Async PatternsdebounceTime, switchMap cancellation, subscription cleanup
§6 Router & NgRx TestingRouterTestingModule, MockStore, selector overrides
§7 LambdaTest IntegrationCloud browser configuration for cross-browser testing
§8 CI/CD IntegrationGitHub Actions with coverage, test reporting
§9 Debugging Table12 common problems with causes and fixes
§10 Best Practices14-item checklist for production Angular testing

Comments

Markdown supported