angular-testing

Solid

Write Angular component tests using TestBed, ComponentHarness, and HttpTestingController with proper signal input handling. Use when writing component tests, mocking HTTP calls, or testing signal inputs. (triggers: **/*.spec.ts, TestBed, ComponentFixture, TestHarness, provideHttpClientTesting)

Testing & QA 387 stars 108 forks Updated 1 weeks ago Apache-2.0

Install

View on GitHub

Quality Score: 87/100

Stars 20%
86
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
68
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Testing ## **Priority: P1 (HIGH)** ## 1. Query via Component Harnesses - Always use `ComponentHarness` (e.g., `MatButtonHarness`) instead of CSS selectors — harnesses are stable across DOM changes. See [harness pattern](references/harness-pattern.md) for ComponentHarness examples. ## 2. Mock HTTP with HttpTestingController - Use `provideHttpClientTesting()` instead of manual HttpClient mocks. - Call `expectOne`, `.flush(mockData)`, and `verify()` in `afterEach`. See [harness pattern](references/harness-pattern.md) for HttpTestingController examples. ## 3. Test Signal Inputs Correctly - Use `fixture.componentRef.setInput('name', value)` — do NOT assign directly. - Call `fixture.detectChanges()` after `setInput()`. - Signals update synchronously — `fakeAsync` is usually not needed. ## 4. Choose Your Test Runner - Angular v20+ supports **Vitest** natively via `@angular/build:unit-test`. Faster, native ESM, no Karma needed. - Jasmine/Karma still supported for existing projects. ## Anti-Patterns - **No DOM CSS selectors**: Query via `ComponentHarness`, not CSS class strings. - **No manual HttpClient mock**: Use `provideHttpClientTesting()` + `HttpTestingController`. - **No direct @Input() assignment**: Use `fixture.componentRef.setInput()` for signal inputs. ## References - [Harness Pattern](references/harness-pattern.md)

Details

Author
HoangNguyen0403
Repository
HoangNguyen0403/agent-skills-standard
Created
2 months ago
Last Updated
1 weeks ago
Language
TypeScript
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Listed

unit-testing

Unit testing patterns: Vitest config with v8 coverage, Testing Library behavior testing, MSW for HTTP mocking (vs jest.mock), it.each parametrized tests, spies vs mocks vs stubs, testing async code, snapshot testing guidelines. Use when writing unit and component tests.

11 Updated 1 months ago
rnavarych
Testing & QA Solid

playwright-core

Battle-tested Playwright patterns for E2E, API, component, visual, accessibility, and security testing. Covers locators, assertions, fixtures, network mocking, auth flows, debugging, and framework recipes for React, Next.js, Vue, and Angular. TypeScript and JavaScript.

185 Updated 1 weeks ago
testdino-hq
Web & Frontend Solid

angular-spa

Angular 21.x SPA development skill with TailwindCSS 4.x and daisyUI 5.5.5. Use when building Angular standalone components, services, lazy-loaded routes, unit tests, or creating UI with TailwindCSS + daisyUI. Covers component scaffolding, UI/UX design, accessibility audits, and design systems.

21 Updated 6 days ago
kumaran-is
Testing & QA Listed

e2e

Activate for any work in the tests/e2e/ directory: creating or editing test files (tests/*.test.ts), page objects (pages/), helpers (helpers/), or vitest config. Enforces agent-browser conventions specific to this project.

23 Updated 4 days ago
madarasz
Testing & QA Featured

swift-testing-expert

Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and maintainability in Apple-platform or Swift server projects.

334 Updated 6 days ago
AvdLee