angular-testing

Write unit and integration tests for Angular v20+ applications.

1|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/pkoka888/server-infra-templates --skill angular-testing-pkoka888
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: angular-testing
Source: https://github.com/pkoka888/server-infra-templates/tree/main/.kilo/skills/marketplace/angular-testing
Command: npx skills add https://github.com/pkoka888/server-infra-templates --skill angular-testing-pkoka888

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Many Angular applications using modern patterns (signals, standalone components, OnPush) lack up-to-date, maintainable unit and integration tests; this Skill provides clear patterns and migration guidance to create fast, reliable tests that catch regressions early.

Core Features & Use Cases

  • Vitest and Jasmine guidance: Clear setup and migration tips for Angular v20+ projects including angular.json and tsconfig.spec adjustments.
  • Signal and OnPush testing: Patterns for testing signals, computed values, and components using OnPush change detection.
  • Service and HTTP testing: Examples using TestBed, HttpTestingController or provideHttpClientTesting, and mocking strategies with vi or jasmine spies.
  • Advanced patterns: Component harnesses, fake timers, snapshot testing, parameterized tests, and test utilities for robust, repeatable suites.

Quick Start

Generate Vitest unit tests for a component using TestBed, assert signal updates, and mock HTTP calls with the HttpTestingController.

Frequently Asked Questions about angular-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests for Angular v20 components using signals and OnPush?

Writing unit tests for Angular v20 signal components involves configuring TestBed setups that assert signal updates and verify OnPush change detection behavior. This approach ensures signal-based logic and rendering triggers function correctly without manual fixture handling.

What is the best way to migrate Jasmine tests to Vitest in an Angular application?

Migrating Jasmine tests to Vitest requires adjusting angular.json and tsconfig.spec files for compatibility. You replace Jasmine spies with vi mocks while keeping TestBed-based setups intact to maintain reliable assertions during the transition.

How do I mock HTTP interactions in Angular using HttpTestingController and Vitest?

Mocking HTTP interactions in Angular involves configuring TestBed with provideHttpClientTesting or HttpTestingController. You simulate backend responses and verify HTTP calls using vi spies to ensure your service logic handles requests and errors correctly.

Does Vitest support component harnesses for Angular integration testing?

Vitest supports component harnesses for Angular integration testing by combining TestBed setups with harness utilities. This allows you to interact with component elements programmatically, enabling robust assertions and repeatable test suites for complex UI behaviors.

Can I use provideHttpClientTesting with inject() services in Angular v20?

You can use provideHttpClientTesting with inject() services in Angular v20 by configuring the TestBed environment accordingly. This setup intercepts HTTP requests from your services, allowing you to mock responses and validate service logic without real network dependencies.

Why does my Vitest snapshot test fail for Angular OnPush components?

Vitest snapshot tests for Angular OnPush components fail when change detection is not triggered properly before assertion. You must ensure the fixture detects changes or updates signals so the rendered output matches the expected snapshot state.