angularjs-unit-testing
БесплатноЗапускает вложенные скриптыНе проверенUse this skill for AngularJS unit testing, maintenance, and migration tasks
от greedychipmunk★ 24 звезды на GitHubОб этом скилле
AngularJS Unit Testing Skill
Overview
This skill specializes in writing, refactoring, and maintaining high-quality unit tests for AngularJS (1.x) applications. It covers controllers, services, filters, directives, HTTP mocking, promises, and dependency injection — everything you need to keep an AngularJS codebase well-tested and reliable.
Note: AngularJS reached end-of-life in December 2021. It receives only critical security fixes. New projects should use Angular 19+. For teams maintaining AngularJS codebases, this skill provides the latest testing patterns, tooling, and migration guidance. See Migration Path at the bottom of this document.
Skill Capabilities
Core Testing Competencies
- Controllers: Write tests for controller logic, state management, and event handling
- Services: Test factory/service dependencies, HTTP calls, and business logic
- Filters: Validate filter transformations and edge cases
- Directives: Test directive compilation, linking, and DOM manipulation
- HTTP Mocking: Mock HTTP calls using
$httpBackend(Jasmine/Karma) or MSW/fetch mocks (Jest) - Promises & Async: Handle
$q, deferred objects, and$timeout - Dependency Injection: Test with mocked and real dependencies
- Scope Management: Test scope lifecycle, watchers, and event broadcasting
- Coverage Analysis: Generate and interpret code coverage reports
- Test Organization: Structure tests following best practices and maintainability principles
- Framework Choice: Jest for new work and hybrid repos; Jasmine/Karma for existing suites
Testing Patterns
This skill implements the following testing patterns:
AAA Pattern (Arrange-Act-Assert)
- Organize tests with clear setup, execution, and verification phases
- Improves readability and maintainability
Mocking & Spying
- Use Jasmine spies or Jest mocks to mock functions and verify calls
- Mock HTTP responses and service dependencies
- Simulate user interactions
Test Fixtures
- Create reusable test data and helper functions
- Use beforeEach/afterEach for common setup/teardown
- Reduce test duplication
Edge Case Testing
- Test boundary conditions, empty states, and error scenarios
- Validate error handling and graceful degradation
- Test asynchronous operations and race conditions
Snapshot Testing (Jest)
- Capture expected component output
- Detect unintended changes in UI rendering
Deterministic Async
- Prefer fake timers, controlled promises, and isolated state over timing-sensitive assertions
Testing Frameworks & Test Runners
Jasmine (Legacy Default)
Jasmine remains the safest choice when you are preserving an existing AngularJS + Karma suite.
Key Concepts:
describe(): Group related tests into a test suiteit(): Define individual test casesexpect(): Create assertionsbeforeEach()/afterEach(): Setup and teardown hooksspyOn()/jasmine.createSpy(): Mock functions and track calls
Setup:
npm install --save-dev jasmine karma karma-jasmine karma-chrome-launcher
Use when:
- You are maintaining an existing Jasmine/Karma suite
- You want the smallest possible change set for legacy AngularJS code
Jest (Recommended)
Jest is the modern default for AngularJS test maintenance and migration work. It runs tests in parallel, has stronger mocking APIs, supports snapshots, and includes built-in coverage reporting.
Key Concepts:
describe(): Group related teststest()orit(): Define individual test casesexpect(): Create assertionsbeforeEach()/afterEach(): Setup and teardown hooksjest.fn(): Create mock functionsjest.spyOn(): Spy on existing methodsjest.mock(): Mock modules
Setup:
npm install --save-dev jest jest-preset-angular angular-mocks
npm install @angular/core
Jest Configuration (jest.config.js):
module.exports = {
preset: 'jest-preset-angular',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/setup-jest.js'],
transform: {
'^.+\.js$': 'babel-jest'
},
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js', '!src/**/*.spec.js']
};
Use when:
- You want faster feedback from parallel execution
- You need better mocking, snapshots, and coverage out of the box
- You are preparing an AngularJS codebase for an Angular migration
Karma (Legacy Runner)
Karma is the legacy browser test runner traditionally paired with Jasmine. It is still usable for existing suites, but it has seen no major releases since 2021 and should not be the basis for new investment.
Configuration:
karma.conf.js: Main configuration file- Specifies browser environment, files to load, and plugins
- Supports code coverage reporting and CI integration
Jest Migration Guide
Use these steps when moving an AngularJS test suite from Jasmin
Установить angularjs-unit-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл angularjs-unit-testing?
Use this skill for AngularJS unit testing, maintenance, and migration tasks
Как установить скилл angularjs-unit-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл angularjs-unit-testing запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic