angular-testing
БесплатноБез исполняемых скриптовНе проверенStandards for Component Test Harnesses and TestBed. Use when writing Angular component tests with TestBed or Component Harnesses. (triggers: **/*.spec.ts…
от ComeOnOliver★ 67 звёзд на GitHubОб этом скилле
Testing
Priority: P1 (HIGH)
Principles
- Harnesses: Always use ComponentHarness (e.g., MatButtonHarness or custom ones) to interact with components via getHarness. Never query by CSS class or DOM/CSS selectors in tests — harnesses are stable and don't break when CSS classes change. Wait for await button.click() or similar calls.
- Provider Mocks: Use provideHttpClientTesting() instead of mocking
HttpClientmanually. Inject HttpTestingController to use expectOne,.flush(mockData), and verify() in afterEach. Never mock HttpClient directly. - Signal Testing: Signals update synchronously — no fakeAsync needed usually.
Test Runner
Angular v20+ supports Vitest natively via @angular/build:unit-test builder in angular.json. Vitest is recommended for new projects as it is faster, native ESM, and no Karma needed. Jasmine/Karma still supported.
Signal Input Testing
Use fixture.componentRef.setInput('name', value) to set signal inputs in tests — do NOT assign component.name = value directly — this doesn't work for signal inputs. After setInput() call fixture.detectChanges() to trigger re-render.
Guidelines
- Avoid logic: Tests should just assert inputs and outputs.
- Spectator: Consider using libraries like
@ngneat/spectatorfor cleaner boilerplate if allowed. - Standalone: Import the standalone component directly in
TestBed.configureTestingModule({ imports: [MyComponent] }).
Anti-Patterns
- No DOM CSS selectors: Query via
ComponentHarness, not CSS class strings. - No manual HttpClient mock: Use
provideHttpClientTesting()+HttpTestingController. - No @Input() in tests: Use
fixture.componentRef.setInput()for signal inputs.
References
Установить angular-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл angular-testing?
Standards for Component Test Harnesses and TestBed. Use when writing Angular component tests with TestBed or Component Harnesses. (triggers: **/*.spec.ts, TestBed, ComponentFixture, TestHarness, provideHttpClientTesting)
Как установить скилл angular-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл angular-testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic