DEV.co
Open-Source Testing · testing-library

angular-testing-library

Angular Testing Library is a lightweight testing utility for Angular components that emphasizes behavior-driven tests over implementation details. It provides DOM-focused helpers and integrates with @testing-library/dom to encourage maintainable test practices.

Source: GitHub — github.com/testing-library/angular-testing-library
789
GitHub stars
92
Forks
TypeScript
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorytesting-library/angular-testing-library
Ownertesting-library
Primary languageTypeScript
LicenseMIT — OSI-approved
Stars789
Forks92
Open issues6
Latest releasev19.4.1 (2026-06-05)
Last updated2026-06-22
Sourcehttps://github.com/testing-library/angular-testing-library

What angular-testing-library is

Provides Angular-specific wrappers around @testing-library/dom with utilities for component rendering, input/output handling, and DOM queries. Built on TypeScript, supports Angular 15–22, and requires @testing-library/dom as a peer dependency.

Quickstart

Get the angular-testing-library source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/testing-library/angular-testing-library.gitcd angular-testing-library# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Unit testing Angular components

Ideal for testing individual components with a focus on user interactions and rendered output rather than internal state or component methods.

Regression test suites for Angular applications

Well-suited for maintaining test bases that remain stable across refactors and component implementation changes, reducing test maintenance burden.

Teams adopting behavior-driven testing practices

Fits teams transitioning from instance-based testing to DOM-centric, user-interaction-focused test patterns across Angular projects.

Implementation considerations

  • Requires installation of @testing-library/dom as a peer dependency (v17+); verify compatibility matrix against your Angular version before adoption.
  • Test writing follows DOM query patterns (getByRole, getByText, etc.) rather than Angular template syntax; team training on these patterns recommended.
  • Supports both reactive forms and template-driven forms; FAQ notes potential edge cases with jest-dom matchers on reactive forms—test coverage should verify.
  • Handles Angular signals and two-way binding via model() and input()/output() APIs; ensure tests account for these patterns if used in your components.
  • Installation via ng add schematic available; manual npm install also supported. Verify dev dependency setup in package.json after installation.

When to avoid it — and what to weigh

  • Heavy reliance on component instance inspection — Not designed for testing internal component state, private methods, or tight coupling to implementation details; library actively discourages these patterns.
  • End-to-end integration testing across services — Component testing library, not an E2E framework; insufficient for multi-component workflow testing or full application navigation scenarios.
  • Angular versions < 15.1 — Compatibility table shows v12.x and v11.x support only for Angular <15.1; older projects may need legacy library versions.
  • Projects already deeply invested in TestBed/ComponentFixture patterns — Requires paradigm shift away from lower-level Angular testing APIs; migration effort may outweigh benefits for mature, large test suites.

License & commercial use

MIT License—permissive open-source license allowing commercial use, modification, and distribution with attribution and no liability.

MIT License is OSI-approved and permissive for commercial use. No commercial support, SLA, or warranty implied by license; consult LICENSE file for full terms and consider your own risk assessment for production test infrastructure.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

No security vulnerabilities or posture details provided in data. As a dev-time testing library, typical security surface is limited. Review dependencies (Angular, @testing-library/dom) for known vulnerabilities in your supply chain.

Alternatives to consider

Jasmine with Angular TestBed

Angular's built-in testing framework; lower learning curve if already familiar with Angular APIs, but encourages instance-based testing and tighter coupling to implementation.

Cypress + Angular

E2E testing framework providing real browser execution and multi-component workflows; overkill for unit component testing but stronger for integration scenarios.

Vitest with @testing-library/angular

Modern alternative to Jest offering faster test execution; compatible with @testing-library/angular and Vite-based builds, preferred by some teams for performance.

Software development agency

Build on angular-testing-library with DEV.co software developers

Adopt Angular Testing Library to write maintainable, user-centric component tests. Start with npm install and review the compatibility matrix for your Angular version. Our team can guide implementation and training.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

angular-testing-library FAQ

Do I need to install @testing-library/dom separately?
Yes, from v17 onwards @testing-library/dom is required as a peer dependency. Installation via npm install --save-dev @testing-library/angular @testing-library/dom or ng add @testing-library/angular schematic.
What Angular versions are supported?
Angular 15.1+; version compatibility table in README specifies exact mappings (e.g., Angular 22.x uses v19.x, Angular 14.x uses v12.x). Verify your version before upgrading.
Why does toHaveFormValues return an empty object with Reactive Forms?
Known edge case documented in FAQ; likely related to form control binding or jest-dom matcher expectations. Test coverage and form structure review recommended.
Is this suitable for testing services and HTTP calls?
No; this library is component-focused. For service testing, use TestBed or standard Jest mocking. For HTTP testing, use HttpClientTestingModule or mock interceptors.

Custom software development services

Adopting angular-testing-library is usually one piece of a larger software development effort. As a software development agency, DEV.co provides software development services and web development expertise — pairing senior software developers and web developers with your team to design, build, and operate open-source testing software in production.

Ready to improve your Angular test practices?

Adopt Angular Testing Library to write maintainable, user-centric component tests. Start with npm install and review the compatibility matrix for your Angular version. Our team can guide implementation and training.